In MongoDB, How to get the same data while querying to MongoDB collection with input.
Example: Test
is the collection.
{
"LIST": [{
"Number": "1",
"Name": "ABC"
},{
"NUMBER": "2",
"DESCRIPTION": "EFG"
},{
"NUMBER": "3",
"DESCRIPTION": "XYZ"
}]
}
Query : db.getCollection('Test').find({ "Number" : { "$in" : [ "1" , "2" , "3"]}})
after query to DB getting order is different what in query mentioned.
After query to Collection getting following response like 2,3,1
Excepted Response is : 1,2,3
order
Please let me know how to achieve this.