{
    "mode": "perldoc",
    "parameter": "MongoDB::BulkWriteResult",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/MongoDB%3A%3ABulkWriteResult/json",
    "generated": "2026-06-13T21:24:05Z",
    "synopsis": "# returned directly\nmy $result = $bulk->execute;\n# from a WriteError or WriteConcernError\nmy $result = $error->result;\nif ( $result->acknowledged ) {\n...\n}",
    "sections": {
        "NAME": {
            "content": "MongoDB::BulkWriteResult - MongoDB bulk write result document\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version v2.2.2\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "# returned directly\nmy $result = $bulk->execute;\n\n# from a WriteError or WriteConcernError\nmy $result = $error->result;\n\nif ( $result->acknowledged ) {\n...\n}\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This class encapsulates the results from a bulk write operation. It may be returned directly\nfrom \"execute\" or it may be in the \"result\" attribute of a \"MongoDB::DatabaseError\" subclass\nlike \"MongoDB::WriteError\" or \"MongoDB::WriteConcernError\".\n",
            "subsections": []
        },
        "ATTRIBUTES": {
            "content": "insertedcount\nNumber of documents inserted\n\nupsertedcount\nNumber of documents upserted\n\nmatchedcount\nNumber of documents matched for an update or replace operation.\n\ndeletedcount\nNumber of documents removed\n\nmodifiedcount\nNumber of documents actually modified by an update operation. This is not necessarily the same\nas \"matchedcount\" if the document was not actually modified as a result of the update.\n\nThis field is not available from legacy servers before version 2.6. If results are seen from a\nlegacy server (or from a mongos proxying for a legacy server) this attribute will be \"undef\".\n\nYou can call \"hasmodifiedcount\" to find out if this attribute is defined or not.\n\nupserted\nAn array reference containing information about upserted documents (if any). Each document will\nhave the following fields:\n\n*   index — 0-based index indicating which operation failed\n\n*   id — the object ID of the upserted document\n\nupsertedids\nA hash reference built lazily from \"upserted\" mapping indexes to object IDs.\n\ninserted\nAn array reference containing information about inserted documents (if any). Documents are just\nas in \"upserted\".\n\ninsertedids\nA hash reference built lazily from \"inserted\" mapping indexes to object IDs.\n\nwriteerrors\nAn array reference containing write errors (if any). Each error document will have the following\nfields:\n\n*   index — 0-based index indicating which operation failed\n\n*   code — numeric error code\n\n*   errmsg — textual error string\n\n*   op — a representation of the actual operation sent to the server\n\nwriteconcernerrors\nAn array reference containing write concern errors (if any). Each error document will have the\nfollowing fields:\n\n*   index — 0-based index indicating which operation failed\n\n*   code — numeric error code\n\nopcount\nThe number of operations sent to the database.\n\nbatchcount\nThe number of database commands issued to the server. This will be less than the \"opcount\" if\nmultiple operations were grouped together.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "assert\nThrows an error if write errors or write concern errors occurred.\n\nassertnowriteerror\nThrows a MongoDB::WriteError if \"countwriteerrors\" is non-zero; otherwise returns 1.\n\nassertnowriteconcernerror\nThrows a MongoDB::WriteConcernError if \"countwriteconcernerrors\" is non-zero; otherwise\nreturns 1.\n\ncountwriteerrors\nReturns the number of write errors\n\ncountwriteconcernerrors\nReturns the number of write errors\n\nlastcode\nReturns the last \"code\" field from either the list of \"writeerrors\" or \"writeconcernerrors\"\nor 0 if there are no errors.\n\nlasterrmsg\nReturns the last \"errmsg\" field from either the list of \"writeerrors\" or \"writeconcernerrors\"\nor the empty string if there are no errors.\n\nlastwtimeout\nTrue if a write concern timed out or false otherwise.\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "*   David Golden <david@mongodb.com>\n\n*   Rassi <rassi@mongodb.com>\n\n*   Mike Friedman <friedo@friedo.com>\n\n*   Kristina Chodorow <k.chodorow@gmail.com>\n\n*   Florian Ragwitz <rafl@debian.org>\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "This software is Copyright (c) 2020 by MongoDB, Inc.\n\nThis is free software, licensed under:\n\nThe Apache License, Version 2.0, January 2004\n",
            "subsections": []
        }
    },
    "summary": "MongoDB::BulkWriteResult - MongoDB bulk write result document",
    "flags": [],
    "examples": [],
    "see_also": []
}