MCPcopy
hub / github.com/mongodb/node-mongodb-native / findOneAndReplace

Method findOneAndReplace

src/collection.ts:986–1000  ·  view source on GitHub ↗
(
    filter: Filter<TSchema>,
    replacement: WithoutId<TSchema>,
    options?: FindOneAndReplaceOptions
  )

Source from the content-addressed store, hash-verified

984 replacement: WithoutId<TSchema>
985 ): Promise<WithId<TSchema> | null>;
986 async findOneAndReplace(
987 filter: Filter<TSchema>,
988 replacement: WithoutId<TSchema>,
989 options?: FindOneAndReplaceOptions
990 ): Promise<WithId<TSchema> | ModifyResult<TSchema> | null> {
991 return await executeOperation(
992 this.client,
993 new FindOneAndReplaceOperation(
994 this as TODO_NODE_3286,
995 filter,
996 replacement,
997 resolveOptions(this, options)
998 ) as TODO_NODE_3286
999 );
1000 }
1001
1002 /**
1003 * Find a document and update it in one atomic operation. Requires a write lock for the duration of the operation.

Calls 2

executeOperationFunction · 0.90
resolveOptionsFunction · 0.90

Tested by

no test coverage detected