GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Mango::Bulk(3) User Contributed Perl Documentation Mango::Bulk(3)

Mango::Bulk - MongoDB bulk operations

  use Mango::Bulk;

  my $bulk = Mango::Bulk->new(collection => $collection);
  $bulk->insert({foo => 'bar'})->insert({foo => 'baz'})->execute;

Mango::Bulk is a container for MongoDB bulk operations, all operations will be automatically grouped so they don't exceed "max_bson_size" in Mango.

Mango::Bulk implements the following attributes.

  my $collection = $bulk->collection;
  $bulk          = $bulk->collection(Mango::Collection->new);

Mango::Collection object this bulk operation belongs to.

  my $bool = $bulk->ordered;
  $bulk    = $bulk->ordered($bool);

Bulk operations are ordered, defaults to a true value.

Mango::Bulk inherits all methods from Mojo::Base and implements the following new ones.

  my $results = $bulk->execute;

Execute bulk operations. You can also append a callback to perform operation non-blocking.

  $bulk->execute(sub {
    my ($bulk, $err, $results) = @_;
    ...
  });
  Mojo::IOLoop->start unless Mojo::IOLoop->is_running;

  $bulk = $bulk->find({foo => 'bar'});

Query for next update or remove operation.

  $bulk = $bulk->insert({foo => 'bar'});

Insert document.

  $bulk = $bulk->remove;

Remove multiple documents.

  $bulk = $bulk->remove_one;

Remove one document.

  $bulk = $bulk->update({foo => 'bar'});

Update multiple documents.

  $bulk = $bulk->update_one({foo => 'baz'});

Update one document.

  $bulk = $bulk->upsert;

Next update operation will be an "upsert".

Mango, Mojolicious::Guides, <http://mojolicio.us>.
2018-03-17 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.