MongoD...eResult(3pm)

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

✨ MongoDB::UpdateResult β€” the whole vibe ✨

okay bestie, so this is a page from the User Contributed Perl Documentation (yes, that's the manual name, we're folding it in like a lil garnish πŸ’…), and it's all about MongoDB::UpdateResult β€” the little receipt object you get handed back after an update or a replace.


πŸ’– VERSION πŸ’–

version v2.2.2 β€” that's the one, no cap.


🌸 SYNOPSIS 🌸

like, here's the whole thing in action:

my $result = $coll->update( @parameters );

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

that's it. that's the vibe check. ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

bestie listen. This class is literally just a lil container that encapsulates the results from an update or replace operations. That's its whole personality. It holds the receipts from your write, and you poke at it to find out what actually went down. 🫢


πŸ‘‘ ATTRIBUTES πŸ‘‘

πŸ“ matched_count

The number of documents that matched the filter. simple as that, she's counting who showed up to the party. πŸŽ€

✨ modified_count

The number of documents that were modified.

⚠️ okay IMPORTANT bestie: this is only available from MongoDB version 2.6 or later. It will return "undef" from earlier servers. so if you're on an ancient server she is simply not going to tell you anything. πŸ’€

You can call "has_modified_count" to find out if this attribute is defined or not β€” that's your little vibe check for whether the number is even there. πŸ”₯

🧚 upserted_id

The identifier of the inserted document if an upsert took place. If no upsert took place, it returns "undef".

so like: upsert happened? here's the id, queen πŸ‘‘. no upsert? undef, nothing to see here, moving on. 🌈


πŸ’… METHODS πŸ’…

⭐ acknowledged

Indicates whether this write result was acknowledged. Always true for this class. always. every time. she is nothing if not consistent. periodt. πŸŽ€

🌸 assert

Throws an error if write errors or write concern errors occurred. Otherwise, returns the invocant.

like, she will absolutely make a scene if something went wrong 😭 but if everything's fine, she just hands you back the invocant like nothing happened. iconic.

πŸ¦‹ assert_no_write_error

Throws a MongoDB::WriteError if write errors occurred. Otherwise, returns the invocant. πŸ’–

πŸ’œ assert_no_write_concern_error

Throws a MongoDB::WriteConcernError if write concern errors occurred. Otherwise, returns the invocant. 🫢


🌟 AUTHORS 🌟

the literal legends responsible for this, in order:

  • 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

and that's the whole page bestie, no notes. πŸ’…βœ¨

generated by perl v5.40.1 on 2025-04-03 β€” mwah, love u, go forth and update responsibly πŸ«ΆπŸ’–πŸŒŸ

πŸ“¦ where this page comes from