Mongo Query Syntax
Appsmith uses the database command syntax to query MongoDB

Find Query

Syntax

1
{
2
"find": <string>,
3
"filter": <document>,
4
"sort": <document>,
5
"projection": <document>,
6
"skip": <int>,
7
"limit": <int>
8
}
Copied!

Example

1
{
2
"find": "restaurants",
3
"filter": { "rating": { "$gte": 9 }, "cuisine": "italian" },
4
"projection": { "name": 1, "rating": 1, "address": 1 },
5
"sort": { "name": 1 },
6
"limit": 5
7
}
Copied!

Update Query

Syntax

1
{
2
"update": <collection>,
3
"updates": [
4
{
5
"q": <query>,
6
"u": <document or pipeline>
7
}
8
]
9
}
Copied!

Example

1
{
2
"update": "members",
3
"updates": [
4
{
5
"q": { },
6
"u": { "$set": { "status": "A" }, "$inc": { "points": 1 } },
7
"multi": true
8
}
9
]
10
}
Copied!

Insert Query

Syntax

1
{
2
"insert": <collection>,
3
"documents": [ <document>, <document>, ... ],
4
"ordered": <boolean>
5
}
Copied!

Example

1
{
2
"insert": "users",
3
"documents": [
4
{ "_id": 1, "user": "abc123", status: "A" }
5
]
6
}
Copied!

Delete Query

Syntax

1
{
2
"delete": <collection>,
3
"deletes": [
4
{
5
"q" : <query>,
6
"limit" : <integer>
7
}
8
]
9
}
Copied!

Example

1
{
2
"delete": "orders",
3
"deletes": [ {
4
"q": { status: "D" },
5
"limit": 1
6
} ]
7
}
Copied!