This happened to me in 2.6.1 - So, in case anyone wanders into this error, I thought I'd write the answer out.
This first command worked fine, but the second one didn't.
db.test.find({$text: {$search: 'york'}} )
db.test.find({$text: {$search: 'york'}, score: {$meta: 'textScore'}} )
and threw up the error below
{"$err": "Can't canonicalize query: BadValue unknown operator: $meta", "code": 17287}
Turns out I just had the brackets in the wrong place.. and it should have read.
//This works
db.test.find(
{ $text: { $search: 'york' } },
{ score: { $meta: 'textScore' } }
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With