textual syntax for the mango query language.
tango expressions are based on the C syntax. Currently it supports basic comparison operators (==
, >
, >=
, <
, <=
, ||
, &&
) and parentheses for explicit operator precedence.
Match documents whose "director" field has the value "Lars von Trier".
Tango:
director == "Lars von trier"
Mango:
{
"director": "Lars von Trier"
}
&&
(and) operator works as expected:
Tango:
director == "Lars von Trier" && year >= 2010
Mango:
{
"$or": [
{
"director": {
"$eq": "Lars von Trier"
}
}
{
"year": {
"$gte": 2010
}
}
]
}
Use parentheses to create more complex queries.
Tango:
(director === "Lars von Trier" && year >= 2010) || (name == "Paul" && location == "Boston")
Mango:
{
"$or": [
{
"$and": [
{
"=": {
"$eq": "Lars von Trier"
}
},
{
"year": {
"$gte": 2010
}
}
]
},
{
"$and": [
{
"name": {
"$eq": "Paul"
}
},
{
"location": {
"$eq": "Boston"
}
}
]
}
]
}