Details
-
Bug
-
Status: Closed
-
Major - P3
-
Resolution: Done
-
3.4.10
-
None
-
None
-
ALL
-
Description
I faced with some strange things when I was working with mongoose. I got mongodb collection with some docs:
{
|
"_id" : ObjectId("5a0bf58c9616e5016426d5ef"), |
"categoryId" : 101, |
"name" : "Some name of something", |
"price" : 50000, |
"images" : [ |
ObjectId("5a0bf5349616e5016426d5e9"), |
ObjectId("5a0bf6ac9616e5016426d5f7") |
],
|
}
|
When I join images in "images" field by ObjectId, $lookup operator jumble up default order of array. Why is this happening? When I use third-party ODM (Mongoose) to join images default order of images array is preserved.
db.getCollection('trades').aggregate([ |
{ '$match': { |
_id: ObjectId('5a546428f228c3156579fe00') |
}
|
},
|
{
|
'$lookup': { |
from: 'images', |
localField: 'images', |
foreignField: '_id', |
as: 'images' |
}
|
}
|
]);
|
Attachments
Issue Links
- related to
-
SERVER-7528 Order of responses to a MongoDB $in query
-
- Open
-