the .find
function returns a DBCursor
which hasn't got a a .runCommand
-function. So this obviously doesn't work.
But what does work is using your find-query in the text
database command. As you can read in the documentation for text searching, you can pass a filter
as an optional parameter to the text command. These filter documents work exactly like those you pass to find
.
db.jobs.runCommand( "text", {
search: "metal",
filter: {
"salary.max": {
$gte: 50000,
$lte: 120000
}
}
} );