Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
MongoDB::BulkWriteViewUser Contributed Perl DocumentaMongoDB::BulkWriteView(3)

NAME
       MongoDB::BulkWriteView -	Bulk write operations against a	query document

VERSION
       version v2.2.2

SYNOPSIS
	   my $bulk = $collection->initialize_ordered_bulk_op;

	   # Update one	document matching the selector
	   bulk->find( { a => 1	} )->update_one( { '$inc' => { x => 1 }	} );

	   # Update all	documents matching the selector
	   bulk->find( { a => 2	} )->update_many( { '$inc' => {	x => 2 } } );

	   # Update all	documents matching the selector, with respect to a collation
	   bulk->find( { a => {	'$gte' => 'F' }	)->collation($collation)
		 ->update_many(	{ '$inc' => { x	=> 2 } } );

	   # Update all	documents
	   bulk->find( {} )->update_many( { '$inc' => {	x => 2 } } );

	   # Replace entire document (update with whole	doc replace)
	   bulk->find( { a => 3	} )->replace_one( { x => 3 } );

	   # Update one	document matching the selector or upsert
	   bulk->find( { a => 1	} )->upsert()->update_one( { '$inc' => { x => 1	} } );

	   # Update all	documents matching the selector	or upsert
	   bulk->find( { a => 2	} )->upsert()->update_many( { '$inc' =>	{ x => 2 } } );

	   # Replaces a	single document	matching the selector or upsert
	   bulk->find( { a => 3	} )->upsert()->replace_one( { x	=> 3 } );

	   # Remove a single document matching the selector
	   bulk->find( { a => 4	} )->delete_one();

	   # Remove all	documents matching the selector
	   bulk->find( { a => 5	} )->delete_many();

	   # Update any	arrays with the	matching filter
	   bulk->find( {} )->arrayFilters([ { 'i.b' => 1 } ])->update_many( { '$set' =>	{ 'y.$[i].b' =>	2 } } );

	   # Remove all	documents matching the selector, with respect to a collation
	   bulk->find( { a => {	'$gte' => 'F' }	)->collation($collation)->delete_many();

	   # Remove all	documents
	   bulk->find( {} )->delete_many();

DESCRIPTION
       This class provides means to specify write operations constrained by a
       query document.

       To instantiate a	"MongoDB::BulkWriteView", use the find method from
       MongoDB::BulkWrite.

       Except for "arrayFilters", "collation" and "upsert", all	methods	have
       an empty	return on success; an exception	will be	thrown on error.

METHODS
   arrayFilters
	   $bulk->arrayFilters(	$array_filters )->update_many( $modification );

       Returns a new "MongoDB::BulkWriteView" object, where the	specified
       arrayFilter will	be used	to determine which array elements to modify
       for an update operation on an array field.

   collation
	   $bulk->collation( $collation	)->delete_one;

       Returns a new "MongoDB::BulkWriteView" object, where the	specified
       collation will be used to determine which documents match the query
       document.  A collation can be specified for any deletion, replacement,
       or update.

   delete_many
	   $bulk->delete_many;

       Removes all documents matching the query	document.

   delete_one
	   $bulk->delete_one;

       Removes a single	document matching the query document.

   replace_one
	   $bulk->replace_one( $doc );

       Replaces	the document matching the query	document.  The document	to
       replace must not	have any keys that begin with a	dollar sign, "$".

   update_many
	   $bulk->update_many( $modification );

       Updates all documents  matching the query document.  The	modification
       document	must have all its keys begin with a dollar sign, "$".

   update_one
	   $bulk->update_one( $modification );

       Updates a single	document matching the query document.  The
       modification document must have all its keys begin with a dollar	sign,
       "$".

   upsert
	   $bulk->upsert->replace_one( $doc );

       Returns a new "MongoDB::BulkWriteView" object that will treat every
       update, update_one or replace_one operation as an upsert	operation.

AUTHORS
       o   David Golden	<david@mongodb.com>

       o   Rassi <rassi@mongodb.com>

       o   Mike	Friedman <friedo@friedo.com>

       o   Kristina Chodorow <k.chodorow@gmail.com>

       o   Florian Ragwitz <rafl@debian.org>

COPYRIGHT AND LICENSE
       This software is	Copyright (c) 2020 by MongoDB, Inc.

       This is free software, licensed under:

	 The Apache License, Version 2.0, January 2004

perl v5.32.1			  2020-08-13	     MongoDB::BulkWriteView(3)

NAME | VERSION | SYNOPSIS | DESCRIPTION | METHODS | AUTHORS | COPYRIGHT AND LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=MongoDB::BulkWriteView&sektion=3&manpath=FreeBSD+13.1-RELEASE+and+Ports>

home | help