* Update a single document in a collection * * The value of `update` can be either: * - UpdateFilter<TSchema> - A document that contains update operator expressions, * - Document[] - an aggregation pipeline. * * @param filter - The filter used to select the document to update *
(
filter: Filter<TSchema>,
update: UpdateFilter<TSchema> | Document[],
options?: UpdateOptions & { sort?: Sort }
)
| 403 | * @param options - Optional settings for the command |
| 404 | */ |
| 405 | async updateOne( |
| 406 | filter: Filter<TSchema>, |
| 407 | update: UpdateFilter<TSchema> | Document[], |
| 408 | options?: UpdateOptions & { sort?: Sort } |
| 409 | ): Promise<UpdateResult<TSchema>> { |
| 410 | return await executeOperation( |
| 411 | this.client, |
| 412 | new UpdateOneOperation(this.s.namespace, filter, update, resolveOptions(this, options)) |
| 413 | ); |
| 414 | } |
| 415 | |
| 416 | /** |
| 417 | * Replace a document in a collection with another document |