When using MongoDB\'s $in clause, does the order of the returned documents always correspond to the order of the array argument?
I know this is an old thread, but if you're just returning the value of the Id in the array, you may have to opt for this syntax. As I could not seem to get indexOf value to match with a mongo ObjectId format.
obj.map = function() {
for(var i = 0; i < inputs.length; i++){
if(this._id.equals(inputs[i])) {
var order = i;
}
}
emit(order, {doc: this});
};
How to convert mongo ObjectId .toString without including 'ObjectId()' wrapper -- just the Value?