I would like to build a query that returns the best matching document in the DB.
i.e I would like to find a document with the following fields - "animal":"dog" "color":"brown" "pattern":"dots" "size":"small"
If there is no document that has all the above fiels and their corresponding values I would like the query to return the best match. f.e {"animal":"dog", "color":"brown", "size":"small"}
Can I implement a recursive query in mongo db? If so, how? Should I use mapReduce, if so, how? One can think of this problem more as a recommendation system problem in the way I would like to recommend on the item(document) that fits best to the given values, I would appreciate if someone knows a good way to implement the above
I'm using mongodb mongoose and nodejs.
Thank you.