diff options
author | Daniel Gottlieb <daniel.gottlieb@mongodb.com> | 2021-06-17 12:20:58 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-06-22 16:52:38 +0000 |
commit | 807f5130e28fc2295e6ed6bf382a8aff4b9f6fec (patch) | |
tree | ab47d9c57bf005ededc7284eece641fd7bc25a85 /src/mongo/db/dbhelpers.h | |
parent | da173c4995cd000da3d585c254f681f13edd0b2c (diff) | |
download | mongo-807f5130e28fc2295e6ed6bf382a8aff4b9f6fec.tar.gz |
SERVER-56630: Unittest OpObserverImpl::onUpdate for non-transaction calls.
Diffstat (limited to 'src/mongo/db/dbhelpers.h')
-rw-r--r-- | src/mongo/db/dbhelpers.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/db/dbhelpers.h b/src/mongo/db/dbhelpers.h index 0d624e5769a..f1caed50dfe 100644 --- a/src/mongo/db/dbhelpers.h +++ b/src/mongo/db/dbhelpers.h @@ -66,6 +66,15 @@ struct Helpers { bool requireIndex = false); /** + * If `invariantOnError` is true, an error (e.g: no document found) will crash the + * process. Otherwise the empty BSONObj will be returned. + */ + static BSONObj findOneForTesting(OperationContext* opCtx, + const CollectionPtr& collection, + const BSONObj& query, + const bool invariantOnError = true); + + /** * Similar to the 'findOne()' overload above, except returns the RecordId of the first matching * document, or a null RecordId if no such document exists. */ |