{
    "mode": "perldoc",
    "parameter": "MongoDB::BulkWriteView",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/MongoDB%3A%3ABulkWriteView/json",
    "generated": "2026-06-16T10:30:04Z",
    "synopsis": "my $bulk = $collection->initializeorderedbulkop;\n# Update one document matching the selector\nbulk->find( { a => 1 } )->updateone( { '$inc' => { x => 1 } } );\n# Update all documents matching the selector\nbulk->find( { a => 2 } )->updatemany( { '$inc' => { x => 2 } } );\n# Update all documents matching the selector, with respect to a collation\nbulk->find( { a => { '$gte' => 'F' } )->collation($collation)\n->updatemany( { '$inc' => { x => 2 } } );\n# Update all documents\nbulk->find( {} )->updatemany( { '$inc' => { x => 2 } } );\n# Replace entire document (update with whole doc replace)\nbulk->find( { a => 3 } )->replaceone( { x => 3 } );\n# Update one document matching the selector or upsert\nbulk->find( { a => 1 } )->upsert()->updateone( { '$inc' => { x => 1 } } );\n# Update all documents matching the selector or upsert\nbulk->find( { a => 2 } )->upsert()->updatemany( { '$inc' => { x => 2 } } );\n# Replaces a single document matching the selector or upsert\nbulk->find( { a => 3 } )->upsert()->replaceone( { x => 3 } );\n# Remove a single document matching the selector\nbulk->find( { a => 4 } )->deleteone();\n# Remove all documents matching the selector\nbulk->find( { a => 5 } )->deletemany();\n# Update any arrays with the matching filter\nbulk->find( {} )->arrayFilters([ { 'i.b' => 1 } ])->updatemany( { '$set' => { 'y.$[i].b' => 2 } } );\n# Remove all documents matching the selector, with respect to a collation\nbulk->find( { a => { '$gte' => 'F' } )->collation($collation)->deletemany();\n# Remove all documents\nbulk->find( {} )->deletemany();",
    "sections": {
        "NAME": {
            "content": "MongoDB::BulkWriteView - Bulk write operations against a query document\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version v2.2.2\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "my $bulk = $collection->initializeorderedbulkop;\n\n# Update one document matching the selector\nbulk->find( { a => 1 } )->updateone( { '$inc' => { x => 1 } } );\n\n# Update all documents matching the selector\nbulk->find( { a => 2 } )->updatemany( { '$inc' => { x => 2 } } );\n\n# Update all documents matching the selector, with respect to a collation\nbulk->find( { a => { '$gte' => 'F' } )->collation($collation)\n->updatemany( { '$inc' => { x => 2 } } );\n\n# Update all documents\nbulk->find( {} )->updatemany( { '$inc' => { x => 2 } } );\n\n# Replace entire document (update with whole doc replace)\nbulk->find( { a => 3 } )->replaceone( { x => 3 } );\n\n# Update one document matching the selector or upsert\nbulk->find( { a => 1 } )->upsert()->updateone( { '$inc' => { x => 1 } } );\n\n# Update all documents matching the selector or upsert\nbulk->find( { a => 2 } )->upsert()->updatemany( { '$inc' => { x => 2 } } );\n\n# Replaces a single document matching the selector or upsert\nbulk->find( { a => 3 } )->upsert()->replaceone( { x => 3 } );\n\n# Remove a single document matching the selector\nbulk->find( { a => 4 } )->deleteone();\n\n# Remove all documents matching the selector\nbulk->find( { a => 5 } )->deletemany();\n\n# Update any arrays with the matching filter\nbulk->find( {} )->arrayFilters([ { 'i.b' => 1 } ])->updatemany( { '$set' => { 'y.$[i].b' => 2 } } );\n\n# Remove all documents matching the selector, with respect to a collation\nbulk->find( { a => { '$gte' => 'F' } )->collation($collation)->deletemany();\n\n# Remove all documents\nbulk->find( {} )->deletemany();\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This class provides means to specify write operations constrained by a query document.\n\nTo instantiate a \"MongoDB::BulkWriteView\", use the find method from MongoDB::BulkWrite.\n\nExcept for \"arrayFilters\", \"collation\" and \"upsert\", all methods have an empty return on\nsuccess; an exception will be thrown on error.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "arrayFilters\n$bulk->arrayFilters( $arrayfilters )->updatemany( $modification );\n\nReturns a new \"MongoDB::BulkWriteView\" object, where the specified arrayFilter will be used to\ndetermine which array elements to modify for an update operation on an array field.\n\ncollation\n$bulk->collation( $collation )->deleteone;\n\nReturns a new \"MongoDB::BulkWriteView\" object, where the specified collation will be used to\ndetermine which documents match the query document. A collation can be specified for any\ndeletion, replacement, or update.\n\ndeletemany\n$bulk->deletemany;\n\nRemoves all documents matching the query document.\n\ndeleteone\n$bulk->deleteone;\n\nRemoves a single document matching the query document.\n\nreplaceone\n$bulk->replaceone( $doc );\n\nReplaces the document matching the query document. The document to replace must not have any\nkeys that begin with a dollar sign, \"$\".\n\nupdatemany\n$bulk->updatemany( $modification );\n\nUpdates all documents matching the query document. The modification document must have all its\nkeys begin with a dollar sign, \"$\".\n\nupdateone\n$bulk->updateone( $modification );\n\nUpdates a single document matching the query document. The modification document must have all\nits keys begin with a dollar sign, \"$\".\n\nupsert\n$bulk->upsert->replaceone( $doc );\n\nReturns a new \"MongoDB::BulkWriteView\" object that will treat every update, updateone or\nreplaceone operation as an upsert operation.\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::BulkWriteView - Bulk write operations against a query document",
    "flags": [],
    "examples": [],
    "see_also": []
}