This article assumes you have some knowledge of MongoDB and JSON and are comfortable writing queries. If not, please email support@grow.com or chat in on the site and we can help you or point you to more resources.

Key notes: Anything written in the query needs to be valid JSON. This includes key names, helper functions, aggregation and operators etc.

Any valid query will work, as long as it is valid JSON. Notice that an empty query is still valid JSON.

When you make a query, it needs to be valid JSON. In this example winner should be wrapped in double quotes. {"winner": "Fox"}

When using the find method, up to 10,000 records will be returned if the where clause is empty.

Everything written in the query on the find method (or any method) needs to be valid JSON, which includes wrapping every key in double quotes.

Even help functions like $gt  need to be wrapped in double quotes to make them valid JSON. Numbers and booleans do not need to be wrapped since they are still valid JSON unwrapped.

The $or  operator needs to be wrapped in double quotes as well.

Aggregation functions follow the same pattern, and need to be wrapped in double quotes.

Queries honor the aggregation pipeline

Your Mongo queries honors the aggregation pipeline. You can find more info about the pipeline here. For example, the $match  and $sort  pipeline operators can take advantage of an index when they occur at the beginning of the pipeline. Here are some examples of aggregation provided by Mongo.

Questions? Email us at support@grow.com or chat in on the site.

Did this answer your question?