In our last post, we learned how to find all the documents within a collection using find() method. This post will illustrate on how to find document from a collection using a where clause to satisfy particular condition.
First Insert Records in a Collection.
In the above example, collection Loan is created with 2 parameters :
1) name/type of loan
2) Interest rate
To find a document with a matching condition, we need to pass an object of BasicDBObject class with the condition. For example, we need to find out all the documents from collection Loans where name = "Personal Loan".
Refer below example to do so