I am doing a find() operation on my collection like this:
db.posts.find({
"$or":[
{ "name": keywords },
{ "description": keywords },
{ "tags": keywords }
]
});
keywords is a RegEx, everything works great.
But I was wondering if there was a way in MongoDB to know which field matched name
or description
or tags
. Or a way to count matching fields.
Thank you.