Reputation: 755
Following on from a question relating to count in full text searches. Does anyone have a way to skip records returned from a full text search for pagenation purposes?
Example text search -
db.jobs.runCommand("text", {search: "Australia"});
Regards, Sean
Upvotes: 3
Views: 910
Reputation: 831
The text command returns “a document that contains a field results that contains an array of highest scoring document, in descending order by score.” Please see the following link on text command details.
http://docs.mongodb.org/manual/reference/command/text/
Both limit and skip will not apply in this case since the returned document is neither a cursor nor an aggregation operation. You will have to improvise limit and skip operations in your application. There are plans to integrate text search into normal MongoDB query stream. You can follow the ticket and vote for the feature under the More Actions button.
https://jira.mongodb.org/browse/SERVER-9063
In addition, the returned document must be able to fit into 16 MB, the BSON document size. Consider using $project and $limit parameters to limit the size of results.
Upvotes: 3