why are these queries so complicated? This question is more for the creator of this language. I think its unnecessarily complicated or maybe I need more time to get used to it…
for example below is very simple query:
BELOW:
[
{
‘$match’: {
‘imdb.rating’: { ‘$gte’: 7 },
‘genres’: {’$nin’: [ ‘Crime’, ‘Horror’ ]},
‘rated’: { ‘$in’: [‘PG’, ‘G’]},
‘$and’: [{‘languages’: {’$eq’: ‘English’}}, {‘languages’: ‘$eq’: ‘Japanese’} } ]
}
},
{
‘$project’: {’_id’: 0, ‘title’: 1, ‘rated’: 1}
}
]
COULD HAVE BEEN DONE LIKE THIS…IT IS SO SIMPLE, EASY TO UNDERSTAND AND HUMAN REDABLE…
[
{
‘$match’: {
‘imdb.rating’ > 7 },
‘genres’ $nin [ ‘Crime’, ‘Horror’ ],
‘rated’ $in [‘PG’, ‘G’],
{‘languages’ == ‘English’} $and {‘languages’ == ‘Japanese’}
}
},
{
‘$project’: {’‘title’, ‘rated’}
}
]