UNPKG

mongo-portable

Version:

Portable Pure JS MongoDB - Based on Monglodb (https://github.com/euforic/monglodb.git) by Christian Sullivan (http://RogueSynaptics.com)

1,104 lines (689 loc) 27.2 kB
MongoPortable ============= Solution for a MongoDB-like portable database. [![Package Version](https://img.shields.io/npm/v/mongo-portable.svg?label=Package%20Version)](https://www.npmjs.com/package/mongo-portable) [![NodeJS Version](https://img.shields.io/badge/node-v4.4.0-blue.svg?label=Node%20Version)](https://nodejs.org/en/) [![Travis Build](https://img.shields.io/travis/EastolfiWebDev/MongoPortable.svg?label=linux)](https://travis-ci.org/EastolfiWebDev/MongoPortable) [![Appveyor Build](https://img.shields.io/appveyor/ci/eastolfi/MongoPortable/master.svg?label=windows)](https://ci.appveyor.com/project/eastolfi/mongoportable) [![Codeship Build](https://codeship.com/projects/d57e8820-5e10-0134-8b6d-42ae3f63aed8/status?branch=master)](https://codeship.com/projects/174143) [![Test Coverage](https://coveralls.io/repos/github/EastolfiWebDev/MongoPortable/badge.svg?branch=master)](https://coveralls.io/github/EastolfiWebDev/MongoPortable?branch=master) [![Downloads](https://img.shields.io/npm/dt/mongo-portable.svg)](https://www.npmjs.com/package/mongo-portable) [![Documentation Status](https://readthedocs.org/projects/mongoportable/badge/?version=latest)](http://mongoportable.readthedocs.io/en/latest/?badge=latest) MongoPortable is a module that handles collections and documents in memory, and allow the use of stores for persistence. This project adheres to the Contributor Covenant [code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to eduardo.astolfi91.com. Installation ============ ```shell npm install mongo-portable yarn add mongo-portable ``` Usage ===== ```javascript // Declaring the module dependency import { MongoPortable } from "mongo-portable"; // Instantiates a new ddbb object by passing a ddbb name let db = new MongoPortable("DB_NAME"); // Creates a new collection named "users" // (if it's already created, it will just return it instead) db.collection("users").then(collection => { // Inserts a new document into the collection collection.insert({ name: "John", lastName: "Abruzzi" }).then(document => { console.log(document); // -> { name: "John", lastName: "Abruzzi" } // Performs a query against this collection, fetching all the results users.find({ name: "John" }).then(documents => { console.log(documents); // -> [ { name: "John", lastName: "Abruzzi" } ] }); }); }); ``` Modules ======= The main modules available are [MongoPortable](#MongoPortable) and [Collection](#Collection) (and [Cursor](#Cursor) when using the "doNotFetch" option). MongoPortable ------------- Handles the database, collections and connections. Read the full API documentation [here](https://github.com/EastolfiWebDev/MongoPortable/blob/master/api/MongoPortable.md) Collection ---------- Handles the list of documents by using cursors. Read the full API documentation [here](https://github.com/EastolfiWebDev/MongoPortable/blob/master/api/Collection.md) Cursor ------ Fetchs and access the documents to return them to the client. Read the full API documentation [here](https://github.com/EastolfiWebDev/MongoPortable/blob/master/api/Cursor.md) * * * Stores ====== File System Store ----------------- It is located in a separated module, so install it by: ```shell npm install file-system-store yarn add file-system-store ``` And then use it in your application by adding it in your MongoPortable instance: ```javascript import { FileSystemStore } from "file-system-store"; db.addStore(new FileSystemStore(/* options */)); ``` or as a middleware: ```javascript import { FileSystemStore } from "file-system-store"; db.use("store", new FileSystemStore(/* options */)); ``` View the package [here](https://github.com/EastolfiWebDev/FileSystemStore) and read the full API documentation [here](https://github.com/EastolfiWebDev/FileSystemStore/blob/master/api/FileSystemStore.md) * * * Contributing ------------ Feel free to contribute with your own ideas / fixes! There is a [to-do list](#TO-DO List) with the features I'd like to add in the feature, and a serie of milestones with the roadmap I have in mind. Take a look at them if you want to :) Every contribution should be addressed with a well-formed pull request -> [Contributing](CONTRIBUTING.md) * * * License ======= [MIT](LICENSE.txt) ## Index ### Classes * [Aggregation](classes/aggregation.md) * [BaseStore](classes/basestore.md) * [BinaryParser](classes/binaryparser.md) * [BinaryParserBuffer](classes/binaryparserbuffer.md) * [Collection](classes/collection.md) * [ConnectionHelper](classes/connectionhelper.md) * [Cursor](classes/cursor.md) * [Document](classes/document.md) * [EventEmitter](classes/eventemitter.md) * [MongoPortable](classes/mongoportable.md) * [ObjectId](classes/objectid.md) * [Options](classes/options.md) * [Selector](classes/selector.md) * [SelectorMatcher](classes/selectormatcher.md) * [Utils](classes/utils.md) ### Interfaces * [IAbstractStore](interfaces/iabstractstore.md) * [IClause](interfaces/iclause.md) * [IConnection](interfaces/iconnection.md) ### Variables * [MACHINE_ID](#machine_id) * [checkForHexRegExp](#checkforhexregexp) * [chr](#chr) * [database](#database) * [maxBits](#maxbits) * [pid](#pid) ### Functions * [applyModifier](#applymodifier) * [doComplexGroup](#docomplexgroup) * [doGroup](#dogroup) * [doMatch](#domatch) * [doProject](#doproject) * [doSingleGroup](#dosinglegroup) * [doSort](#dosort) * [ensureFindParams](#ensurefindparams) * [getDocuments](#getdocuments) * [getObjectSize](#getobjectsize) * [hasSorting](#hassorting) * [isValidHexRegExp](#isvalidhexregexp) * [mapFields](#mapfields) * [modify](#modify) * [testClause](#testclause) * [testLogicalClause](#testlogicalclause) * [testObjectClause](#testobjectclause) * [testOperatorClause](#testoperatorclause) * [testOperatorConstraint](#testoperatorconstraint) ### Object literals * [BSON_TYPES](#bson_types) * [groupOperators](#groupoperators) * [modifiers](#modifiers) * [stages](#stages) --- ## Variables <a id="machine_id"></a> ### MACHINE_ID **● MACHINE_ID**: *`number`* = parseInt(`${Math.random() * 0xFFFFFF}`, 10) *Defined in [document/ObjectId.ts:15](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/document/ObjectId.ts#L15)* Machine id. Create a random 3-byte value (i.e. unique for this process). Other drivers use a md5 of the machine id here, but that would mean an asyc call to gethostname, so we don"t bother. *__ignore__*: ___ <a id="checkforhexregexp"></a> ### checkForHexRegExp **● checkForHexRegExp**: *`RegExp`* = new RegExp("^[0-9a-fA-F]{24}$") *Defined in [document/ObjectId.ts:18](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/document/ObjectId.ts#L18)* ___ <a id="chr"></a> ### chr **● chr**: *`fromCharCode`* = String.fromCharCode *Defined in [binary/BinaryParser.ts:9](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/binary/BinaryParser.ts#L9)* ___ <a id="database"></a> ### database **● database**: *`any`* = null *Defined in [collection/Collection.ts:48](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/collection/Collection.ts#L48)* Collection *__module__*: Collection *__constructor__*: *__since__*: 0.0.1 *__author__*: Eduardo Astolfi [eastolfi91@gmail.com](mailto:eastolfi91@gmail.com) *__copyright__*: 2016 Eduardo Astolfi [eastolfi91@gmail.com](mailto:eastolfi91@gmail.com) *__license__*: MIT Licensed *__classdesc__*: Collection class that maps a MongoDB-like collection ___ <a id="maxbits"></a> ### maxBits **● maxBits**: *`any`[]* = [] *Defined in [binary/BinaryParser.ts:11](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/binary/BinaryParser.ts#L11)* ___ <a id="pid"></a> ### pid **● pid**: *`number`* = Math.floor(Math.random() * 100000) *Defined in [document/ObjectId.ts:25](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/document/ObjectId.ts#L25)* ___ ## Functions <a id="applymodifier"></a> ### applyModifier**applyModifier**(_docUpdate: *`any`*, key: *`any`*, val: *`any`*): `any` *Defined in [collection/Collection.ts:1088](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/collection/Collection.ts#L1088)* **Parameters:** | Param | Type | | ------ | ------ | | _docUpdate | `any` | | key | `any` | | val | `any` | **Returns:** `any` ___ <a id="docomplexgroup"></a> ### doComplexGroup ▸ **doComplexGroup**(): `void` *Defined in [aggregation/Aggregation.ts:156](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L156)* **Returns:** `void` ___ <a id="dogroup"></a> ### doGroup**doGroup**(documents: *`any`*, groupStage: *`any`*): `Object`[] *Defined in [aggregation/Aggregation.ts:170](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L170)* **Parameters:** | Param | Type | | ------ | ------ | | documents | `any` | | groupStage | `any` | **Returns:** `Object`[] ___ <a id="domatch"></a> ### doMatch ▸ **doMatch**(documents: *`any`*, matchStage: *`any`*): `any` *Defined in [aggregation/Aggregation.ts:164](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L164)* **Parameters:** | Param | Type | | ------ | ------ | | documents | `any` | | matchStage | `any` | **Returns:** `any` ___ <a id="doproject"></a> ### doProject**doProject**(documents: *`any`*, projectStage: *`any`*): `any` *Defined in [aggregation/Aggregation.ts:192](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L192)* **Parameters:** | Param | Type | | ------ | ------ | | documents | `any` | | projectStage | `any` | **Returns:** `any` ___ <a id="dosinglegroup"></a> ### doSingleGroup ▸ **doSingleGroup**(groupId: *`any`*, groupStage: *`any`*, documents: *`any`*): `Object`[] *Defined in [aggregation/Aggregation.ts:95](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L95)* **Parameters:** | Param | Type | | ------ | ------ | | groupId | `any` | | groupStage | `any` | | documents | `any` | **Returns:** `Object`[] ___ <a id="dosort"></a> ### doSort**doSort**(documents: *`any`*, sortStage: *`any`*): `any` *Defined in [aggregation/Aggregation.ts:160](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L160)* **Parameters:** | Param | Type | | ------ | ------ | | documents | `any` | | sortStage | `any` | **Returns:** `any` ___ <a id="ensurefindparams"></a> ### ensureFindParams ▸ **ensureFindParams**(params: *`any`*): `any` *Defined in [collection/Collection.ts:1363](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/collection/Collection.ts#L1363)* **Parameters:** | Param | Type | | ------ | ------ | | params | `any` | **Returns:** `any` ___ <a id="getdocuments"></a> ### `<Private>` getDocuments**getDocuments**(cursor: *`any`*, justOne?: *`boolean`*): `any` *Defined in [collection/Cursor.ts:610](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/collection/Cursor.ts#L610)* Retrieves one or all the documents in the cursor **Parameters:** | Param | Type | Default value | Description | | ------ | ------ | ------ | ------ | | cursor | `any` | - | The cursor with the documents | | `Default value` justOne | `boolean` | false | **Returns:** `any` If [justOne=true] returns the next document, otherwise returns all the documents ___ <a id="getobjectsize"></a> ### getObjectSize ▸ **getObjectSize**(obj: *`any`*): `number` *Defined in [collection/Collection.ts:21](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/collection/Collection.ts#L21)* Gets the size of an object. **Parameters:** | Param | Type | Description | | ------ | ------ | ------ | | obj | `any` | The object | **Returns:** `number` The size of the object ___ <a id="hassorting"></a> ### `<Private>` hasSorting**hasSorting**(cursor: *`any`*): `boolean` *Defined in [collection/Cursor.ts:684](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/collection/Cursor.ts#L684)* Checks if a cursor has a sorting defined **Parameters:** | Param | Type | Description | | ------ | ------ | ------ | | cursor | `any` | The cursor | **Returns:** `boolean` Whether the cursor has sorting or not ___ <a id="isvalidhexregexp"></a> ### isValidHexRegExp ▸ **isValidHexRegExp**(str: *`any`*, len?: *`number`*): `boolean` *Defined in [document/ObjectId.ts:19](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/document/ObjectId.ts#L19)* **Parameters:** | Param | Type | Default value | | ------ | ------ | ------ | | str | `any` | - | | `Default value` len | `number` | 24 | **Returns:** `boolean` ___ <a id="mapfields"></a> ### mapFields**mapFields**(doc: *`any`*, fields: *`any`*): `any` *Defined in [collection/Cursor.ts:535](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/collection/Cursor.ts#L535)* **Parameters:** | Param | Type | | ------ | ------ | | doc | `any` | | fields | `any` | **Returns:** `any` ___ <a id="modify"></a> ### modify ▸ **modify**(document: *`any`*, keyparts: *`any`*, value: *`any`*, key: *`any`*, level?: *`number`*): `any` *Defined in [collection/Collection.ts:1113](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/collection/Collection.ts#L1113)* **Parameters:** | Param | Type | Default value | | ------ | ------ | ------ | | document | `any` | - | | keyparts | `any` | - | | value | `any` | - | | key | `any` | - | | `Default value` level | `number` | 0 | **Returns:** `any` ___ <a id="testclause"></a> ### testClause**testClause**(clause: *`any`*, val: *`any`*): `any` *Defined in [selector/SelectorMatcher.ts:368](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/SelectorMatcher.ts#L368)* **Parameters:** | Param | Type | | ------ | ------ | | clause | `any` | | val | `any` | **Returns:** `any` ___ <a id="testlogicalclause"></a> ### testLogicalClause ▸ **testLogicalClause**(clause: *`any`*, doc: *`any`*, key: *`any`*): `any` *Defined in [selector/SelectorMatcher.ts:470](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/SelectorMatcher.ts#L470)* **Parameters:** | Param | Type | | ------ | ------ | | clause | `any` | | doc | `any` | | key | `any` | **Returns:** `any` ___ <a id="testobjectclause"></a> ### testObjectClause**testObjectClause**(clause: *`any`*, doc: *`any`*, key: *`any`*): `any` *Defined in [selector/SelectorMatcher.ts:444](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/SelectorMatcher.ts#L444)* **Parameters:** | Param | Type | | ------ | ------ | | clause | `any` | | doc | `any` | | key | `any` | **Returns:** `any` ___ <a id="testoperatorclause"></a> ### testOperatorClause ▸ **testOperatorClause**(clause: *`any`*, value: *`any`*): `boolean` *Defined in [selector/SelectorMatcher.ts:501](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/SelectorMatcher.ts#L501)* **Parameters:** | Param | Type | | ------ | ------ | | clause | `any` | | value | `any` | **Returns:** `boolean` ___ <a id="testoperatorconstraint"></a> ### testOperatorConstraint**testOperatorConstraint**(key: *`any`*, operatorValue: *`any`*, clauseValue: *`any`*, docVal: *`any`*, clause: *`any`*): `any` *Defined in [selector/SelectorMatcher.ts:513](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/SelectorMatcher.ts#L513)* **Parameters:** | Param | Type | | ------ | ------ | | key | `any` | | operatorValue | `any` | | clauseValue | `any` | | docVal | `any` | | clause | `any` | **Returns:** `any` ___ ## Object literals <a id="bson_types"></a> ### BSON_TYPES **BSON_TYPES**: *`object`* *Defined in [selector/SelectorMatcher.ts:664](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/SelectorMatcher.ts#L664)* <a id="bson_types.types"></a> #### types **● types**: *( `object` &#124; `object`)[]* = [ { alias: "minKey", number: -1, order: 1, isType: null }, { alias: "null", number: 10, order: 2, isType: null }, { alias: "int", number: 16, order: 3, isType: _.isInteger }, { alias: "long", number: 18, order: 3, isType: _.isNumber }, { alias: "double", number: 1, order: 3, isType: _.isNumber }, { alias: "number", number: null, order: 3, isType: _.isNumber }, { alias: "string", number: 2, order: 4, isType: _.isString }, { alias: "symbol", number: 14, order: 4, isType: _.isSymbol }, { alias: "object", number: 3, order: 5, isType: _.isPlainObject }, { alias: "array", number: 4, order: 6, isType: _.isArray }, { alias: "binData", number: 5, order: 7, isType: null }, { alias: "objectId", number: 7, order: 8, isTypefnc: null }, { alias: "bool", number: 8, order: 9, isType: _.isBoolean }, { alias: "date", number: 9, order: 10, isTypefnc: _.isDate }, // format { alias: "timestamp", number: 17, order: 11, isType: _.isDate }, // format { alias: "regex", number: 11, order: 12, isType: _.isRegExp }, { alias: "maxKey", number: 127, order: 13, isType: null } // undefined 6 // dbPointer // javascript // javascriptWithScope // function ] *Defined in [selector/SelectorMatcher.ts:665](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/SelectorMatcher.ts#L665)* ___ <a id="bson_types.getbyalias"></a> #### getByAlias**getByAlias**(alias: *`any`*): `any` *Defined in [selector/SelectorMatcher.ts:691](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/SelectorMatcher.ts#L691)* **Parameters:** | Param | Type | | ------ | ------ | | alias | `any` | **Returns:** `any` ___ <a id="bson_types.getbyvalue"></a> #### getByValue ▸ **getByValue**(val: *`any`*): `any` *Defined in [selector/SelectorMatcher.ts:697](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/SelectorMatcher.ts#L697)* **Parameters:** | Param | Type | | ------ | ------ | | val | `any` | **Returns:** `any` ___ ___ <a id="groupoperators"></a> ### groupOperators **groupOperators**: *`object`* *Defined in [aggregation/Aggregation.ts:32](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L32)* <a id="groupoperators._avg"></a> #### $avg ▸ **$avg**(documents: *`any`*, newId: *`any`*, newField: *`any`*, value: *`any`*, isCount: *`any`*): `object` *Defined in [aggregation/Aggregation.ts:60](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L60)* **Parameters:** | Param | Type | | ------ | ------ | | documents | `any` | | newId | `any` | | newField | `any` | | value | `any` | | isCount | `any` | **Returns:** `object` ___ <a id="groupoperators._sum"></a> #### $sum**$sum**(documents: *`any`*, newId: *`any`*, newField: *`any`*, value: *`any`*, isCount: *`any`*): `object` *Defined in [aggregation/Aggregation.ts:33](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L33)* **Parameters:** | Param | Type | | ------ | ------ | | documents | `any` | | newId | `any` | | newField | `any` | | value | `any` | | isCount | `any` | **Returns:** `object` ___ ___ <a id="modifiers"></a> ### modifiers **modifiers**: *`object`* *Defined in [collection/Collection.ts:1165](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/collection/Collection.ts#L1165)* *__ignore__*: <a id="modifiers._addtoset"></a> #### $addToSet**$addToSet**(target: *`any`*, field: *`any`*, arg: *`any`*): `void` *Defined in [collection/Collection.ts:1224](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/collection/Collection.ts#L1224)* **Parameters:** | Param | Type | | ------ | ------ | | target | `any` | | field | `any` | | arg | `any` | **Returns:** `void` ___ <a id="modifiers._bit"></a> #### $bit ▸ **$bit**(target: *`any`*, field: *`any`*, arg: *`any`*): `void` *Defined in [collection/Collection.ts:1356](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/collection/Collection.ts#L1356)* **Parameters:** | Param | Type | | ------ | ------ | | target | `any` | | field | `any` | | arg | `any` | **Returns:** `void` ___ <a id="modifiers._inc"></a> #### $inc**$inc**(target: *`any`*, field: *`any`*, arg: *`any`*): `void` *Defined in [collection/Collection.ts:1166](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/collection/Collection.ts#L1166)* **Parameters:** | Param | Type | | ------ | ------ | | target | `any` | | field | `any` | | arg | `any` | **Returns:** `void` ___ <a id="modifiers._pop"></a> #### $pop ▸ **$pop**(target: *`any`*, field: *`any`*, arg: *`any`*): `void` *Defined in [collection/Collection.ts:1254](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/collection/Collection.ts#L1254)* **Parameters:** | Param | Type | | ------ | ------ | | target | `any` | | field | `any` | | arg | `any` | **Returns:** `void` ___ <a id="modifiers._pull"></a> #### $pull**$pull**(target: *`any`*, field: *`any`*, arg: *`any`*): `void` *Defined in [collection/Collection.ts:1270](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/collection/Collection.ts#L1270)* **Parameters:** | Param | Type | | ------ | ------ | | target | `any` | | field | `any` | | arg | `any` | **Returns:** `void` ___ <a id="modifiers._pullall"></a> #### $pullAll ▸ **$pullAll**(target: *`any`*, field: *`any`*, arg: *`any`*): `void` *Defined in [collection/Collection.ts:1312](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/collection/Collection.ts#L1312)* **Parameters:** | Param | Type | | ------ | ------ | | target | `any` | | field | `any` | | arg | `any` | **Returns:** `void` ___ <a id="modifiers._push"></a> #### $push**$push**(target: *`any`*, field: *`any`*, arg: *`any`*): `void` *Defined in [collection/Collection.ts:1198](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/collection/Collection.ts#L1198)* **Parameters:** | Param | Type | | ------ | ------ | | target | `any` | | field | `any` | | arg | `any` | **Returns:** `void` ___ <a id="modifiers._pushall"></a> #### $pushAll ▸ **$pushAll**(target: *`any`*, field: *`any`*, arg: *`any`*): `void` *Defined in [collection/Collection.ts:1210](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/collection/Collection.ts#L1210)* **Parameters:** | Param | Type | | ------ | ------ | | target | `any` | | field | `any` | | arg | `any` | **Returns:** `void` ___ <a id="modifiers._rename"></a> #### $rename**$rename**(target: *`any`*, field: *`any`*, value: *`any`*): `void` *Defined in [collection/Collection.ts:1342](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/collection/Collection.ts#L1342)* **Parameters:** | Param | Type | | ------ | ------ | | target | `any` | | field | `any` | | value | `any` | **Returns:** `void` ___ <a id="modifiers._set"></a> #### $set ▸ **$set**(target: *`any`*, field: *`any`*, arg: *`any`*): `void` *Defined in [collection/Collection.ts:1182](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/collection/Collection.ts#L1182)* **Parameters:** | Param | Type | | ------ | ------ | | target | `any` | | field | `any` | | arg | `any` | **Returns:** `void` ___ <a id="modifiers._unset"></a> #### $unset**$unset**(target: *`any`*, field: *`any`*, arg: *`any`*): `void` *Defined in [collection/Collection.ts:1186](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/collection/Collection.ts#L1186)* **Parameters:** | Param | Type | | ------ | ------ | | target | `any` | | field | `any` | | arg | `any` | **Returns:** `void` ___ ___ <a id="stages"></a> ### stages **stages**: *`object`* *Defined in [aggregation/Aggregation.ts:16](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L16)* <a id="stages._geonear"></a> #### $geoNear **● $geoNear**: *`boolean`* = false *Defined in [aggregation/Aggregation.ts:26](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L26)* ___ <a id="stages._group"></a> #### $group **● $group**: *`boolean`* = true *Defined in [aggregation/Aggregation.ts:23](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L23)* ___ <a id="stages._indexstats"></a> #### $indexStats **● $indexStats**: *`boolean`* = false *Defined in [aggregation/Aggregation.ts:29](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L29)* ___ <a id="stages._limit"></a> #### $limit **● $limit**: *`boolean`* = false *Defined in [aggregation/Aggregation.ts:20](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L20)* ___ <a id="stages._lookup"></a> #### $lookup **● $lookup**: *`boolean`* = false *Defined in [aggregation/Aggregation.ts:27](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L27)* ___ <a id="stages._match"></a> #### $match **● $match**: *`boolean`* = true *Defined in [aggregation/Aggregation.ts:18](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L18)* ___ <a id="stages._out"></a> #### $out **● $out**: *`boolean`* = false *Defined in [aggregation/Aggregation.ts:28](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L28)* ___ <a id="stages._project"></a> #### $project **● $project**: *`boolean`* = true *Defined in [aggregation/Aggregation.ts:17](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L17)* ___ <a id="stages._redact"></a> #### $redact **● $redact**: *`boolean`* = false *Defined in [aggregation/Aggregation.ts:19](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L19)* ___ <a id="stages._sample"></a> #### $sample **● $sample**: *`boolean`* = false *Defined in [aggregation/Aggregation.ts:24](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L24)* ___ <a id="stages._skip"></a> #### $skip **● $skip**: *`boolean`* = false *Defined in [aggregation/Aggregation.ts:21](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L21)* ___ <a id="stages._sort"></a> #### $sort **● $sort**: *`boolean`* = true *Defined in [aggregation/Aggregation.ts:25](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L25)* ___ <a id="stages._unwind"></a> #### $unwind **● $unwind**: *`boolean`* = false *Defined in [aggregation/Aggregation.ts:22](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/aggregation/Aggregation.ts#L22)* ___ ___