MongoDB-无法规范化查询:BadValue未知运算符:$ meta [英] MongoDB - Can't canonicalize query: BadValue unknown operator: $meta

查看:385
本文介绍了MongoDB-无法规范化查询:BadValue未知运算符:$ meta的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这在2.6.1中发生在我身上-因此,万一有人误入该错误,我想我应该把答案写出来.

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'}} )

并抛出以下错误

{"$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' } }
);

这篇关于MongoDB-无法规范化查询:BadValue未知运算符:$ meta的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆