简体   繁体   中英

Get the actual node being used when connecting to a MongoDB replicaSet

I'm querying data from a mongoDB replica-set. The queries take quite a long time and I'd like to be sure that the data is not being read from the wrong node.

Is it possible to get the actual node being used for a given query?

I'm using the PHP mongoDB client.

Once you have run the query and started iterating the cursor, it is possible to get information about the host where the query is run. You can get it by running info() method on cursor object. Check this - php.net/manual/en/mongocursor.info.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM