具有保留名称的Mongodb查找
我需要对集合中名为“group”的mongodb执行find()命令,但“group”显然是保留名称,所以。。我需要选择它与其他命令行。在这种情况下,我如何执行find() 我的测试:具有保留名称的Mongodb查找,mongodb,Mongodb,我需要对集合中名为“group”的mongodb执行find()命令,但“group”显然是保留名称,所以。。我需要选择它与其他命令行。在这种情况下,我如何执行find() 我的测试: > db['group'].find() Tue Nov 3 09:30:22.132 TypeError: Object function ( parmsObj ){ var ret = this.runCommand( { "group" : this._groupFixParms( parmsObj
> db['group'].find()
Tue Nov 3 09:30:22.132 TypeError: Object function ( parmsObj ){
var ret = this.runCommand( { "group" : this._groupFixParms( parmsObj ) } );
if ( ! ret.ok ){
throw "group command failed: " + tojson( ret );
}
return ret.retval;
} has no method 'find'
使用
在您的例子中,方法对于名称可能与shell本身交互的集合非常有用,这些名称以
\u
开头,或者镜像数据库命令,如或@balancin不用担心,很乐意帮助:)
db.getCollection("group").find()