0

I want to show result in specific order. I have two categories on request instant and want to show instant record first.

Here is my data:

{
    "_id" : ObjectId("5f34d12d269ab90441440285"),
    "bookingPolicy" : "instant"
},
{
    "_id" : ObjectId("5f34d12d269ab90441440286"),
    "bookingPolicy" : "on request"
},
{
    "_id" : ObjectId("5f2d66490e41163dc558bc0d"),
    "bookingPolicy" : "instant"
}

I want to show instant record first with _id sort.

  • You can use cursor.sort to sort the collection's documents by specifying the field(s) and the sort order. – prasad_ Sep 17 at 2:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.