0

I have a users collection which contains documents with name key. I have data of users as follow:

name

halex
alex
galexi
joe alex

I need to apply find() query for alex. My query is:

db.users.find({name:"alex"});

In my result I get the alex at 3rd position.

I want it on 1st position because of the exact match. Example:

alex
halex
joe alex
galexi

0 Answers0