Created
October 30, 2016 03:28
-
-
Save bradvogel/5e33ada9d7398f0379c3442f42c5459b to your computer and use it in GitHub Desktop.
mongo querying range of search results
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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