gpt4 book ai didi

MongoDB 3.6.2 $out 因重复键错误而失败

转载 作者:行者123 更新时间:2023-12-02 03:51:30 26 4
gpt4 key购买 nike

这是意外失败的聚合查询:

db.sq_lesson_user_lessons.aggregate([
{
"$match": {
lesson_id: {
"$in": [ObjectId("5bb6ec0a178353bbdecdd94d"), ObjectId("5bbf1e611783538013ce2f0a")]
},
status: { "$in": ['featured','started','pending','completed'] }
}
},
{
"$project": {
_id: 1,
user_profile_id: 1,
status: 1,
lesson_id: 1
}
},
{
"$out": "analytics_company_5bb6039598f17297c964fc54_sq_user_lessons"
}
])

assert: command failed: {
"operationTime" : Timestamp(1542715086, 67659),
"ok" : 0,
"errmsg" : "insert for $out failed: { lastOp: { ts: Timestamp(1542715086, 67657), t: 39 }, connectionId: 242551, err: \"E11000 duplicate key error collection: api_smartquest_co_production.tmp.agg_out.637145 index: _id_ dup key: { : ObjectId('5bf22e554b8a982ada5e2828') }\", code: 11000, codeName: \"DuplicateKey\", n: 0, ok: 1.0, operationTime: Timestamp(1542715086, 67657), $clusterTime: { clusterTime: Timestamp(1542715086, 67658), signature: { hash: BinData(0, 0000000000000000000000000000000000000000), keyId: 0 } } }",
"code" : 16996,
"codeName" : "Location16996",
"$clusterTime" : {
"clusterTime" : Timestamp(1542715086, 67659),
"signature" : {
"hash" : BinData(0,"wvZz15/714/PHqAWywLpZlP4azQ="),
"keyId" : NumberLong("6606442824109916161")
}
}
} : aggregate failed

此聚合会产生大约 30 万条记录。有时聚合有效,有时失败。

最佳答案

Daniel Hatcher 回答了这个问题来自 MongoDB,带有以下评论:

https://jira.mongodb.org/browse/SERVER-38212?focusedCommentId=2067603&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-2067603

答案的关键是:

由于聚合是在大型集合中搜索以返回结果,因此某些文档可能会被多次返回。这与 MongoDB's read isolation 中的概念之一相关。 。

关于MongoDB 3.6.2 $out 因重复键错误而失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53389686/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com