我正在嘗試使用以下代碼在新集合中插入更多檔案:
await client.db(db).collection(newCollection).insertOne(newDocument);
但是,這會遇到錯誤代碼 8000,此處未記錄:https ://github.com/mongodb/mongo/blob/master/src/mongo/base/error_codes.yml 。
MongoServerError: cannot create a new collection -- already using 500 collections of 500
at Connection.onMessage (/home/pi/projects/myProject/node_modules/mongodb/lib/cmap/connection.js:210:30)
at MessageStream.<anonymous> (/home/pi/projects/myProject/node_modules/mongodb/lib/cmap/connection.js:63:60)
at MessageStream.emit (node:events:527:28)
at processIncomingData (/home/pi/projects/myProject/node_modules/mongodb/lib/cmap/message_stream.js:132:20)
at MessageStream._write (/home/pi/projects/myProject/node_modules/mongodb/lib/cmap/message_stream.js:33:9)
at writeOrBuffer (node:internal/streams/writable:390:12)
at _write (node:internal/streams/writable:331:10)
at Writable.write (node:internal/streams/writable:335:10)
at TLSSocket.ondata (node:internal/streams/readable:766:22)
at TLSSocket.emit (node:events:527:28) {
ok: 0,
code: 8000,
codeName: 'AtlasError',
[Symbol(errorLabels)]: Set(0) {}
}
我做了進一步的研究,發現一個創建的集合數量不受用戶限制(“一般來說,盡量將你的副本集限制為 10,000 個集合”),如下所述:https: //www.mongodb.com/developer/ products/mongodb/schema-design-anti-pattern-massive-number-collections/#:~:text=In general, try to limit your replica set to 10,000 collections。
我在共享集群上使用 Atlas。這是 Atlas 問題還是我的代碼有問題?
uj5u.com熱心網友回復:
是的,這是atlas M0免費限制。看Database and Collections 這里
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/495725.html
上一篇:查詢MongoDb檔案中的子檔案,只回傳匹配的子檔案
下一篇:pymongo.errors.ServerSelectionTimeoutError:RepliceSetNoPrimary-MongoDBAtlas
