无法从shell 中删除集合,
集合可用,我的php脚本正在访问它( Select |更新)
但当我使用:
db._registration.drop()
这给了我一个错误:
Date, JS Error: TypeErrorL db._registration has no properties (shell): 1
无法从shell 中删除集合,
集合可用,我的php脚本正在访问它( Select |更新)
但当我使用:
db._registration.drop()
这给了我一个错误:
Date, JS Error: TypeErrorL db._registration has no properties (shell): 1
问题不在于删除集合.问题在于访问集合.因此,您将无法从shell更新、查找或使用它执行任何操作.正如在mongodb JIRA中指出的,当集合包含_
、-
或这样的字符时,这是一个错误.
不过,这种类型的集合名称是可以接受的,但它会在shell中造成问题.
您可以使用以下命令在shell中删除它:
db.getCollection("_registration").drop()
还是这个
db['my-collection'].drop()
但我宁愿重新命名它(当然,如果可能的话,也不会有太多的变化).