MongoD...Result(3pm)

πŸ“¦
version 2.2.2 Β· 5 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

✨ MongoDB::InsertOneResult β€” bestie edition ✨

okay so this is a User Contributed Perl Documentation page for MongoDB::InsertOneResult, and honestly? it's giving tiny-but-mighty. it's the lil result object you get back when you insert ONE single document. that's it. that's the whole vibe. πŸ’…


πŸ¦‹ NAME πŸ¦‹

MongoDB::InsertOneResult β€” the result object for a single MongoDB insert, no cap.

🌸 VERSION 🌸

version v2.2.2 β€” yeah she's got a version number, she's official.

⭐ SYNOPSIS ⭐

here's the whole moment, bestie:

my $result = $coll->insert( $document );

if ( $result->acknowledged ) {
    ...
}

like. you insert a doc, you get a result back, you peek at acknowledged and carry on with your day. iconic behavior. πŸ‘‘

πŸ’– DESCRIPTION πŸ’–

This class encapsulates the result from the insertion of a single document. (<- that's the actual technical deal, and yes, "encapsulates" is doing a lot of heavy lifting there, but we respect her.)

πŸŽ€ ATTRIBUTES πŸŽ€

✨ inserted_id

The identifier of the inserted document. that's it. that's the one attribute. she's simple, she's focused, she knows what she is. πŸ’œ

πŸ”₯ METHODS πŸ”₯

πŸ’« acknowledged

Indicates whether this write result was acknowledged. Always true for this class. like literally always. every single time. she doesn't know how to be anything else. πŸ’…

πŸ’« assert

Throws an error if write errors or write concern errors occurred. Otherwise, returns the invocant. so like, it's the vibe check method β€” if something's wrong it YELLS, if everything's fine it just hands you back $self like "we're good bestie 🫢".

πŸ’« assert_no_write_error

Throws a MongoDB::WriteError if write errors occurred. Otherwise, returns the invocant. so this one only cares about that ONE specific kind of problem and completely ignores the other kind. very focused. very narrow. very cunty of her honestly. ✨

πŸ’« assert_no_write_concern_error

Throws a MongoDB::WriteConcernError if write concern errors occurred. Otherwise, returns the invocant. same energy as above but for write concern errors specifically. two different methods, two different error types, no merging, no mixing. periodt. πŸŽ€

ngl the pattern here is so clean: each assert returns the invocant when it's happy, and throws when it's not. chain them, whatever, she doesn't mind. 😭

πŸ‘‘ AUTHORS πŸ‘‘

look at this lineup omg, absolute legends:

  • David Golden <david@mongodb.com>
  • Rassi <rassi@mongodb.com>
  • Mike Friedman <friedo@friedo.com>
  • Kristina Chodorow <k.chodorow@gmail.com>
  • Florian Ragwitz <rafl@debian.org>

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

This is free software, licensed under:

The Apache License, Version 2.0, January 2004

okay that's the whole page bestie, go forth and insert exactly one document at a time πŸ’–

signing off with love β€” this ran on perl v5.40.1, dated 2025-04-03, and it's the MongoD...Result(3pm) page, mwah πŸ’‹

πŸ“¦ where this page comes from