I can't figure out how to sort query results based on the "best" match.
Here's a simple example, I have a "zone" collection containing a list of city/zipcode couples.
If I search several words through the regex using the "and" keyword like that :
"db.zones.find({$or : [ {ville: /ROQUE/}, {ville: /ANTHERON/}] })"
Results won't be ordered by "best match".
What other solutions do I have for that ?
findis binary - a document does or does not match. Your best options are to use text search as suggested below, or, if you return a small number of documents, manually re-sort the docs into whatever best match order you have in mind.