我在mongoDB上运行count
查询。但是得到以下错误。
app.get('/doc/count', (req, res) => {
doc.count(req.query).then((count) => {
res.send({ count });
}, (err) => {
res.status(400).send(err);
});
});
但是我收到以下错误。适用于当地的mongodb。
{
"name": "MongoError",
"message": "query in command must target a single shard key",
"_t": "OKMongoResponse",
"ok": 0,
"code": 61,
"errmsg": "query in command must target a single shard key",
"$err": "query in command must target a single shard key"
}