practicing with mongo
I have a collection
{
"_id" : "158748",
"data" : {
"1" : {
"tem" : 0,
"sal" : 0,
},
"3" : {
"tem" : 0,
"sal" : 0,
},
"4" : {
"tem" : 0,
"sal" : 0,
},
"2" : {
"tem" : 0,
"sal" : 0,
}
}
}
and to sort it in the find () query
db.getCollection('data').find({'_id':158748}).sort({"data":1 });
does not work, I saw another one
db.getCollection('data').find({$query:{'_id':158748}, $orderby:{"data":1 }});
but gives this error
Error: error: {
"waitedMS" : NumberLong(0),
"ok" : 0,
"errmsg" : "unknown top level operator: $query",
"code" : 2
}
I do not know how it could be done so that as a result of the find with the values of "data" computer by its key