我一直在使用Mongodb的NodeJS,MongooseJS。当我尝试使用mongooseJS在mongodb中插入记录时,抛出以下错误
"MongoError: right object doesn't have full shard key"
仅供参考:具有分片键的MongoDB表
请告诉我如何解决这个问题!这个错误是什么意思?
我对MongoDB和node.js完全陌生,并且面临着这个问题。 你知道是什么导致了这个错误吗? MongoServerSelectionError: connection <monitor> to 18.158.79.102:27017 closed
at Timeout._onTimeout (C:\dev\Angular assigments\node-server-ivan\node_modules\mongodb\lib\core\sdam\topology.js:438:30)
at listOnTimeout (internal/timers.js:55
我正在使用mongodb,并注意到我们应该在过滤器查询上使用not count()函数,因为会得到这样的警告: @deprecated Use countDocuments or estimatedDocumentCount http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#count 建议的替代countDocuments()使用聚合,在某些情况下,它对我们来说要慢20倍或更多(从10k过滤出的文档的0.5秒到20秒,这使得响应时间无法忍受)。有人声称count()函数可能不准确,尽管我自己从未见过这一