Applying conditional and logical operators on the filter parameter

We can apply conditional parameters while retrieving data from collections, such as IN, AND, and OR with less than and greater than conditions:

  • Apply the IN condition: We can set filter parameters so the query can match values from a given set and retrieve values from collections where documents match values from a given set. The syntax for the in parameter is the following:
{<field 1> : {<operator 1> : <value 1>},....}

The following query will return all the documents from user_profiles where the first name is John or Kedar:

Here, we get all the documents with a firstName ...

Get Seven NoSQL Databases in a Week now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.