Skip to content
This repository has been archived by the owner on Feb 10, 2022. It is now read-only.

Must have $meta projection for all $meta sort keys #163

Open
ghost opened this issue Feb 20, 2017 · 2 comments
Open

Must have $meta projection for all $meta sort keys #163

ghost opened this issue Feb 20, 2017 · 2 comments

Comments

@ghost
Copy link

ghost commented Feb 20, 2017

I'm trying to do a full text search and sort the results by score, but when I run the query I get

Must have $meta projection for all $meta sort keys

This is what I have so far

Model
   .limit(10)
   .skip((page - 1) * 10)
   .sort({ score: { $meta: 'textScore' } })
   .find(query, { score: { $meta: 'textScore' } })
   .then(records => {
     // do something
   })

Am I doing something wrong?

@ghost
Copy link
Author

ghost commented Feb 20, 2017

Never mind, I switched to mongorito@v3 and saw the .search() API. Now the question is: what would be the best approach to count all matched records using full text search for pagination?

@niallobrien
Copy link

I haven't tried it, but there is a count function in the code, have you tried it?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant