Skip to content

Instantly share code, notes, and snippets.

@bradvogel
Created October 30, 2016 03:28
Show Gist options
  • Save bradvogel/5e33ada9d7398f0379c3442f42c5459b to your computer and use it in GitHub Desktop.
Save bradvogel/5e33ada9d7398f0379c3442f42c5459b to your computer and use it in GitHub Desktop.
mongo querying range of search results
db.sequences.aggregate([
{
"$match": {
$text: { $search: 'test' }
}
},
{
$sort: {
score: { $meta: "textScore" },
_id: -1
}
},
{
"$project": {
"_id": 1,
name: 1,
"score": {
"$meta": "textScore"
}
}
},
{
"$match": {
"score": { "$gte": 0.75 },
_id: {$gt: '581549458447b9058a31041c'}
}
}
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment