MCPcopy Create free account
hub / github.com/Automattic/mongoose / Array

Class Array

types/types.d.ts:8–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6
7 namespace Types {
8 class Array<T> extends global.Array<T> {
9 /** Pops the array atomically at most one time per document `save()`. */
10 $pop(): T;
11
12 /** Atomically shifts the array at most one time per document `save()`. */
13 $shift(): T;
14
15 /** Adds values to the array if not already present. */
16 addToSet(...args: any[]): any[];
17
18 isMongooseArray: true;
19
20 /** Pushes items to the array non-atomically. */
21 nonAtomicPush(...args: any[]): number;
22
23 /** Wraps [`Array#push`](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/push) with proper change tracking. */
24 push(...args: any[]): number;
25
26 /**
27 * Pulls items from the array atomically. Equality is determined by casting
28 * the provided value to an embedded document and comparing using
29 * [the `Document.equals()` function.](./api/document.html#document_Document-equals)
30 */
31 pull(...args: any[]): this;
32
33 /**
34 * Alias of [pull](#mongoosearray_MongooseArray-pull)
35 */
36 remove(...args: any[]): this;
37
38 /** Sets the casted `val` at index `i` and marks the array modified. */
39 set(index: number, val: T): this;
40
41 /** Atomically shifts the array at most one time per document `save()`. */
42 shift(): T;
43
44 /** Returns a native js Array. */
45 toObject(options?: ToObjectOptions): any;
46 toObject<T>(options?: ToObjectOptions<T>): T;
47
48 /** Wraps [`Array#unshift`](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/unshift) with proper change tracking. */
49 unshift(...args: any[]): number;
50 }
51
52 class Buffer extends NativeBuffer {
53 /** Sets the subtype option and marks the buffer modified. */

Callers 3

model.test.jsFile · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected