java - How to get Mongo server address when I call findOne API -


This is a follow-up to my last assuming I have an application that reads the closest priority . Now I would like to verify that Mongo node actually handles the questions.

I know that I can get that Mongo node with code> DBCRor.Get ServerAdWords API.

Suppose I call DBCollection.findOne , which returns a single DBObject DBCursor . How can I get a Mongo node address in this case?

The simple answer is that you do not do this. The implementation is simply a feature wrapper around normal, which restricts the response of a document in contrast to opposing the cursor.

As such, the return is actually just a simple cover ( ordered keys with it and a definite sequence of serials ) and thus there are no special qualities associated with an object like this. .

So if it is really important to you, what you want to do actually , for one Code> Find and range . Here you can handle manually that findone has the cursor's access to what you are doing and to make calls as needed.

He said, I am strong strongly because you did not have a real reason (example analysis tool) to do this, because as you It was, in fact, that should should come from primary. And even if you accept reading from a secondary, then your application should not be cautious.

However, go and use as much as you like.


Comments