and it work fine but I want to show those document on top which match both $OR condition and those which match one condition show on last so for that I want to add score to each document if it match both condition then add score = 2 and if match one condition then score = 1 and then i’ll sort it with score.
but problem is how to calculate score for each document ?
I want my query to return this type of document like:
I read this https://mongodb.prakticum-team.ru/docs/atlas/atlas-search/scoring/
link suggest to create index but I have very long query of $or which match 9 to 10 fields and creating such large compound index is I thing not good so that I don’t wanna create index for that.
I have one other solution to get record from query and add score and sort it from JavaScript code but I want to do that from query.