To use IN clause in MongoDB, we need to create the list and set the list as value with key as "$in"
In our last post, we learned how to find the document with where clause within a collection. This post will illustrate on how to find documents from a collection using IN clause.
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 where name = "Personal Loan" or "Home Loan", we need to use "$in" as a key.
Refer to example :