MongoD...Result(3pm)
β¨ 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>
π 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
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
- debian trixie: libmongodb-perl 2.2.2-3 Β· Apache-2.0
- ubuntu resolute: libmongodb-perl 2.2.2-3 Β· Apache-2.0
- ubuntu stonking: libmongodb-perl 2.2.2-3 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms