Reputation: 42050
I have a Java application, which works with a Mongo replica set. The replica set consists of two Mongo instances (primary and secondary) in different hosts
Suppose the application is executing a query (e.g. find a document in a collection). I don't know what read preference it uses. Suppose also that both primary and secondary instances store the same data.
Now I need to know which Mongo instance the application has called to execute the query: the primary, the secondary, or the both.
How can I do that ?
I would prefer a solution, which does not require access to the application code.
Upvotes: 1
Views: 108
Reputation: 6233
The default read preference is primary so if you didn't change it, that's where it's reading.
Upvotes: 2