我正在使用 MongoDB 的 Sandbox(版本:3.2.12)数据库,并且部署在 mLab 上。添加/插入记录时我遇到了一个奇怪的问题(来自 shell 和应用程序)。
我没有为数据库文件设置任何配额限制。
错误信息:
“错误信息:配额超出错误代码:12501”
但我在数据库中有足够的内存,我可以在“xyz”集合之外的其他集合中添加/插入记录。
但是,我已经从“xyz”集合中删除了一些记录以释放内存并再次尝试插入记录。例如。删除了集合中的 2 条记录,之后仅插入了 2 条记录。
我能否将更多文件添加到我的配额中,如果可以,如何添加?
有什么办法可以调试吗?或者任何其他不删除数据库的解决方案?
最佳答案
请尝试修复您的数据库。
Sometimes it’s necessary to compact your database in order to reclaim disk space (e.g., are you quickly approaching your storage limits?) and/or reduce fragmentation. When you compact your database, you are effectively reducing its file size.
Compacting Sandbox and single-node plan deployments
If you are on a Sandbox or single-node plan and would like to try to reclaim disk space, you can use MongoDB’s repairDatabase command.
If your fileSize or “Size on Disk” is under 1.5 GB, you can run this repair command directly through our UI by visiting the page for your database, clicking on the “Tools” tab next, and then selecting “repairDatabase” from the drop-down list. Otherwise, you can run the db.repairDatabase() command after connecting to your database with the mongo shell.
https://docs.mlab.com/ops/#compacting
repairDatabase 命令是一个阻塞操作。在修复完成之前,您的数据库将不可用。
这可能需要大约 20-30 秒。
关于MongoDB - 配额超出错误代码 : 12501,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42619558/