{
"_id" : ObjectId (" 59 fb2e93670c90000ab85efb "),
"RelateId" : NumberLong (124),
"A list" : [
{
"RelateId" : NumberLong (206),
"Position" : 10
},
{
"RelateId" : NumberLong (208),
"Position" : 4
}
],
"CreateAt" : NumberLong (1489258188083),
"UpdateAt" : NumberLong (1505796172787)
}
{
"_id" : ObjectId (" 59 fb2e93670c90000ab86efb "),
"RelateId" : NumberLong (125),
"A list" : [
{
"RelateId" : NumberLong (208),
"Position" : 5
}
],
"CreateAt" : NumberLong (1489258188083),
"UpdateAt" : NumberLong (1505796172787)
}
The query is
Db. The find ({" list. RelateId ": {$in: [208]}}), sort ({" list. The position" : 1})
Is first found out the list. The relateId contains 208, again according to sort the list object position in the field, the query results should be the second in the above ideal, because more than 4, 5
But the result is the first in the above because the position of 206 is 10. So how do I only according to the list relateId equals 208 sort, no matter the list there are no other data.
CodePudding user response:
Forget it, didn't find the answer, the search sorted with solr to solveCodePudding user response:
"Mongo calculation difficulty summarized this article to see if I can help you