mongodb 数字集合名称删除

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9790049/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 12:33:08  来源:igfitidea点击:

Numeric Collection Name Remove

mongodbmongodb-php

提问by Petrogad

How can you drop a numeric collection from MongoDB?

如何从 MongoDB 中删除数字集合?

PRIMARY> db.123456789011.remove({});
Tue Mar 20 08:42:51 SyntaxError: missing ; before statement (shell):1

PRIMARY> db.123456789011.drop({});
Tue Mar 20 08:43:13 SyntaxError: missing ; before statement (shell):1

Was created through a PHP script.. now I can't figure out how to remove this..

是通过 PHP 脚本创建的.. 现在我不知道如何删除它..

Thoughts?

想法?

Thank you

谢谢

回答by dampier

This should work:

这应该有效:

   db["123456789011"].drop()

回答by David

I was having the same issue with a collection generated by a java class

我对由 java 类生成的集合遇到了同样的问题

db["1234"].drop()
Wed Jul  9 14:57:39.358 TypeError: Cannot call method 'drop' of undefined

and at the end used the following command to remove it.

最后使用以下命令将其删除。

db.getCollection('1234').drop()