mongo-dot-notation
Version:
Transform objects to MongoDB update instructions
64 lines (63 loc) • 3.2 kB
TypeScript
/**
* Replaces the value of a field with the specified value.
* @param value replacement value
* @see https://www.mongodb.com/docs/manual/reference/operator/update/set/
*/
export declare const $set: <T>(value: T) => import("./operator").Operator;
/**
* Increments a field by a specified value.
* @param value amount to increment by (default `1`)
* @see https://www.mongodb.com/docs/manual/reference/operator/update/inc/
*/
export declare const $inc: <T>(value?: T) => import("./operator").Operator;
/**
* Updates the value of the field to a specified value if the specified value is **greater than**
* the current value of the field.
* @param value max value
* @see https://www.mongodb.com/docs/manual/reference/operator/update/max/
*/
export declare const $max: <T>(value: T) => import("./operator").Operator;
/**
* Updates the value of the field to a specified value if the specified value is **less than**
* the current value of the field.
* @param value min value
* @see https://www.mongodb.com/docs/manual/reference/operator/update/min/
*/
export declare const $min: <T>(value: T) => import("./operator").Operator;
/**
* Multiplies the value of a field by a number.
* @param value multiply factor (default `1`)
* @see https://www.mongodb.com/docs/manual/reference/operator/update/mul/
*/
export declare const $mul: <T>(value?: T) => import("./operator").Operator;
/**
* Updates the name of a field.
* @param field new field name
* @see https://www.mongodb.com/docs/manual/reference/operator/update/rename/
*/
export declare const $rename: (field: string) => import("./operator").Operator;
/**
* Assigns the specified value to the field when `{ upsert: true }` operation is used and
* results in a new document being created. If the update operation does not result in an insert,
* does nothing.
* @param value the value to set on document creation
* @see https://www.mongodb.com/docs/manual/reference/operator/update/setOnInsert/
*/
export declare const $setOnInsert: <T>(value: T) => import("./operator").Operator;
/**
* Deletes the specified field from a document.
* @see https://www.mongodb.com/docs/manual/reference/operator/update/unset/
*/
export declare const $unset: () => import("./operator").Operator;
/**
* Sets the value of a field to the current date.
* @param type (default `date`) when `date` is used sets to MongoDB's [Date](https://www.mongodb.com/docs/manual/reference/bson-types/#std-label-document-bson-type-date) type, for `timestamp` sets to [Timestamp](https://www.mongodb.com/docs/manual/reference/bson-types/#std-label-document-bson-type-timestamp).
* @see https://www.mongodb.com/docs/manual/reference/operator/update/currentDate/
*/
export declare const $currentDate: (type?: 'date' | 'timestamp') => import("./operator").Operator;
/**
* Sets the value of a field to the current date as a MondoDB's [Timestamp](https://www.mongodb.com/docs/manual/reference/bson-types/#std-label-document-bson-type-timestamp) type.
* This is an alias for `$currentDate('timestamp')`.
* @see https://www.mongodb.com/docs/manual/reference/operator/update/currentDate/
*/
export declare const $timestamp: () => import("./operator").Operator;