API - MongoAdapter

Extends AbstractAdapter

The MongoDB database adapter. This adapter will create a connection with the MongoDB server

Methods

This method will delete an existing row.

Parameters
Name Type Description
collection Collection The MongoDB Collection.
query DeleteQuery The query to execute.

Returns Promise: A promise containing the deleted row.

This method will insert one single item into the database.

Parameters
Name Type Description
collection Collection The MongoDB Collection.
query InsertQuery The query to execute.

Returns Promise: A promise containing the inserted row.

This method will hold all the logic for the select query.

Parameters
Name Type Description
collection Collection The MongoDB Collection
query SelectQuery The query to execute.

This method will update an existing object.

Parameters
Name Type Description
collection Collection The MongoDB Collection.
query UpdateQuery The query to execute.

Returns Promise: A promise containing the updated row.

This function will return the indexes on the selected table.

Parameters
Name Type Description
name String The table name to get the indexed from

Returns Promse: The promise with all the information.

This method will receive various information of the server.

Parameters
Name Type Description
name String The table name from which to return the data.

Returns Promise: The promise with the server information.

This function will be available for every object, this will clone the current object.

Returns Object: An exact copy of the current object

This is an intermediary method that will check your query and send it through to the correct method.

Parameters
Name Type Description
query Object The query to be executed

Returns Promise: The promise with the received data

This is a private function to allow for config extending This method takes two parameters the first is the original config and the second will be appeneded to this one.

Parameters
Name Type Description
target Object The config object.
source Object The object to extend the config object.

Return the command chain to run behaviors.

Returns CommandChain: CommandChain object.

Use this function to acquire a variable from config.js

Parameters
Name Type Description
key String Key to specify the config to return

Returns Object: The requested config value.

Use this function to acquire the identifier object

Returns ObjectIdentifier: Identifier object.

This method will return a single instance of a server connection. If the connection does not exists it will try to create it.

Parameters
Name Type Description
name String The instance name
config Object The config object for the connection.

Returns Promise: The server connection to use.

This is a alias of ObjectManager.getObject to use in the "this" context.

Parameters
Name Type Description
identifier String Identifier of the object to load
config Object|null Config to push to the object

Returns Promise: call ".then" to use the object when ready.

This function must return a query builder object, or sele when overridden.

Returns Undefined | :

This method will create the schema to use.

Parameters
Name Type Description
name String The name of the table to get the schema from.

Returns Promise: The promise containing the schema.

Every object called through getObject will go through this function. This will set the identifier and adds the behaviors (if any).

Parameters
Name Type Description
config Object Object with config values

Returns Promise: call ".then" to use the object when ready.

This is the handler which will try to mixin functions from another object.

Parameters
Name Type Description
object Object The object to mix into the current object.