method IMongoCollection.findOneAndUpdate
IMongoCollection.findOneAndUpdate(
filter: Record<string, unknown>,
update: Record<string, unknown>,
): Promise<Record<string, unknown> | null>

Finds one document and applies an update, returning the updated document.

Parameters

filter: Record<string, unknown>

The match filter

update: Record<string, unknown>

The update document ($set form)

The findOneAndUpdate options

Return Type

Promise<Record<string, unknown> | null>

The updated document, or null when none matched

Usage

import { type IMongoCollection } from "database-plugin/src/index.ts";