1.

How is Querying done in MongoDB?

Answer»

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"})



Discussion

No Comment Found