helene
Version:
Real-time Web Apps for Node.js
49 lines (48 loc) • 1.95 kB
TypeScript
/**
* The signature of modifier functions is as follows
* Their structure is always the same: recursively follow the dot notation while creating
* the nested documents if needed, then apply the "last step modifier"
*/
export declare const LastStepModifierFunctions: {
/**
* Set a field to a new value
*/
$set: (obj: any, field: any, value: any) => void;
/**
* Unset a field
*/
$unset: (obj: any, field: any, value: any) => void;
/**
* Push an element to the end of an array field
* Optional modifier $each instead of value to push several values
* Optional modifier $slice to slice the resulting array, see https://docs.mongodb.org/manual/reference/operator/update/slice/
* Différeence with MongoDB: if $slice is specified and not $each, we act as if value is an empty array
*/
$push: (obj: any, field: any, value: any) => void;
/**
* Add an element to an array field only if it is not already in it
* No modification if the element is already in the array
* Note that it doesn't check whether the original array contains duplicates
*/
$addToSet: (obj: any, field: any, value: any) => void;
/**
* Remove the first or last element of an array
*/
$pop: (obj: any, field: any, value: any) => void;
/**
* Removes all instances of a value from an existing array
*/
$pull: (obj: any, field: any, value: any) => void;
/**
* Increment a numeric field's value
*/
$inc: (obj: Record<string, any>, field: string, value: number) => void;
/**
* Updates the value of the field, only if specified field is greater than the current value of the field
*/
$max: (obj: any, field: any, value: any) => void;
/**
* Updates the value of the field, only if specified field is smaller than the current value of the field
*/
$min: (obj: any, field: any, value: any) => void;
};