Google News
logo
MongoDB - Interview Questions
How is Querying done in MongoDB?
The find method is used to perform queries in MongoDB. Querying returns a subset of documents in a collection, from no documents at all to the entire collection. Which documents get returned is determined by the first argument to find, which is a document specifying the query criteria.
 
For example : If we have a string we want to match, such as a "username" key with the value "alice", we use that key/value pair instead:
 
> db.users.find({"username" : "alice"})
 
Advertisement