在Mongodb中的BulkWrite期间,是否有任何方法可以获取单个文档中多个“重复键错误”的详细信息

时间:2019-01-18 06:34:19

标签: mongodb

我有2个文档,DB_1中的docA和DB_2中的docB

docA

{
    "_id" : ObjectId("5c36390fae88df153176ea46"),
    "info" : {
        "display_name" : "Abc"
    },
    "status" : "enabled",
    "created" : 1547057423.619553,
    "modified" : 1547057423.619553,
    "version" : 1,
    "external_ids" : {
        "email_original" : "abc@xyz.com",
        "canonical_id" : "805c363cc23f91f579323903c9",
        "email" : "abc@xyz.com"
    },
    "apikeys" : [ ],
    "type" : "account"
}

docB

{
    "_id" : ObjectId("5c36390fae88df153176ea46"),
    "info" : {
        "display_name" : "abc"
    },
    "status" : "enabled",
    "created" : 1547057423.619553,
    "modified" : 1547057423.619553,
    "version" : 1,
    "external_ids" : {
        "email_original" : "abc@xyz.com",
        "canonical_id" : "805c363cc23f91f579323903c9",
        "email" : "abc@xyz.com"
    },
    "apikeys" : [ ],
    "type" : "account"
}

在docA和docB中,有2个冲突-电子邮件和canonical_id,但在BulkWrite期间,它会为其中一个键引发冲突错误,而不能同时出现两者。

有什么方法可以报告两个冲突的密钥(电子邮件和canonical_id)而不是仅一个?

0 个答案:

没有答案