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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.