Members
crc
Returns a checksum of a string.
Methods
(static) collection(options) → {*}
The main handler method. This gets called by all the other variants and
handles the actual logic of the overloaded method.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | An options object. |
- Source:
Returns:
- Type
- *
(static) collection(collectionName) → {Collection}
Get a collection by name. If the collection does not already exist
then one is created for that name automatically.
Parameters:
Name | Type | Description |
---|---|---|
collectionName |
String | The name of the collection. |
- Source:
Returns:
- Type
- Collection
(static) collection(collectionName, primaryKey, options) → {Collection}
Get a collection by name. If the collection does not already exist
then one is created for that name automatically.
Parameters:
Name | Type | Description |
---|---|---|
collectionName |
String | The name of the collection. |
primaryKey |
String | Optional primary key to specify the primary key field on the collection objects. Defaults to "_id". |
options |
Object | An options object. |
- Source:
Returns:
- Type
- Collection
(static) collection(collectionName, options) → {Collection}
Get a collection by name. If the collection does not already exist
then one is created for that name automatically.
Parameters:
Name | Type | Description |
---|---|---|
collectionName |
String | The name of the collection. |
options |
Object | An options object. |
- Source:
Returns:
- Type
- Collection
(static) collection(collectionName, primaryKey) → {Collection}
Get a collection by name. If the collection does not already exist
then one is created for that name automatically.
Parameters:
Name | Type | Description |
---|---|---|
collectionName |
String | The name of the collection. |
primaryKey |
String | Optional primary key to specify the primary key field on the collection objects. Defaults to "_id". |
- Source:
Returns:
- Type
- Collection
(static) collection(collectionName) → {Collection}
Get a collection with no name (generates a random name). If the
collection does not already exist then one is created for that
name automatically.
Parameters:
Name | Type | Description |
---|---|---|
collectionName |
String | The name of the collection. |
- Source:
Returns:
- Type
- Collection
(static) collection(data) → {Collection}
Get a collection by name. If the collection does not already exist
then one is created for that name automatically.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | An options object or a collection instance. |
- Source:
Returns:
- Type
- Collection
(static) document(documentName) → {*}
Creates a new document instance.
Parameters:
Name | Type | Description |
---|---|---|
documentName |
String | The name of the document to create. |
- Source:
Returns:
- Type
- *
(static) documents() → {Array}
Returns an array of documents the DB currently has.
- Source:
Returns:
An array of objects containing details of each document
the database is currently managing.
- Type
- Array
(static) drop(removePersist, callback)
Drops the database and optionally controls dropping persistent storage
and callback method.
Parameters:
Name | Type | Description |
---|---|---|
removePersist |
Boolean | Drop persistent storage for this database. |
callback |
function | Optional callback method. |
(static) drop(callback)
Drops the database with optional callback method.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | Optional callback method. |
(static) drop()
Drops the database.
(static) drop(removePersist)
Drops the database with optional persistent storage drop. Persistent
storage is dropped by default if no preference is provided.
Parameters:
Name | Type | Description |
---|---|---|
removePersist |
Boolean | Drop persistent storage for this database. |
(static) grid(selector, template, optionsopt) → {*}
Creates a grid based on the passed arguments.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
selector |
String | The jQuery selector of the grid to retrieve. | |
template |
String | The table template to use when rendering the grid. | |
options |
Object |
<optional> |
The options object to apply to the grid. |
Returns:
- Type
- *
(static) gridExists(selector) → {boolean}
Determine if a grid with the passed name already exists.
Parameters:
Name | Type | Description |
---|---|---|
selector |
String | The jQuery selector to bind the grid to. |
Returns:
- Type
- boolean
(static) grids() → {Array}
Returns an array of grids the DB currently has.
Returns:
An array of objects containing details of each grid
the database is currently managing.
- Type
- Array
(static) moduleLoaded(moduleName, success, failure)
Checks if a module is loaded and if so calls the passed
success method, otherwise calls the failure method.
Parameters:
Name | Type | Description |
---|---|---|
moduleName |
String | The name of the module to check for. |
success |
function | The callback method to call if module is loaded. |
failure |
function | The callback method to call if module not loaded. |
(static) moduleLoaded(moduleName, callback)
Checks if a module is loaded and if so calls the passed
callback method.
Parameters:
Name | Type | Description |
---|---|---|
moduleName |
String | The name of the module to check for. |
callback |
function | The callback method to call if module is loaded. |
(static) moduleLoaded(moduleName) → {Boolean}
Checks if a module has been loaded into the database.
Parameters:
Name | Type | Description |
---|---|---|
moduleName |
String | The name of the module to check for. |
Returns:
True if the module is loaded, false if not.
- Type
- Boolean
(static) unGrid(selector, template, optionsopt) → {*}
Removes a grid based on the passed arguments.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
selector |
String | The jQuery selector of the grid to retrieve. | |
template |
String | The table template to use when rendering the grid. | |
options |
Object |
<optional> |
The options object to apply to the grid. |
Returns:
- Type
- *
arrayToCollection(arr) → {Collection}
Converts a normal javascript array of objects into a DB collection.
Parameters:
Name | Type | Description |
---|---|---|
arr |
Array | An array of objects. |
Returns:
A new collection instance with the data set to the
array passed.
- Type
- Collection
collectionExists(viewName) → {boolean}
Determine if a collection with the passed name already exists.
Parameters:
Name | Type | Description |
---|---|---|
viewName |
String | The name of the collection to check for. |
- Source:
Returns:
- Type
- boolean
collectionGroups() → {Array}
Returns an array of collection groups the DB currently has.
- Source:
Returns:
An array of objects containing details of each collection group
the database is currently managing.
- Type
- Array
collections(search) → {Array}
Returns an array of collections the DB currently has.
Parameters:
Name | Type | Description |
---|---|---|
search |
String | RegExp | The optional search string or regular expression to use to match collection names against. |
- Source:
Returns:
An array of objects containing details of each collection
the database is currently managing.
- Type
- Array
emit(event, dataopt) → {*}
Emits an event by name with the given data.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
event |
String | The name of the event to emit. | |
data |
* |
<optional> |
The data to emit with the event. |
Returns:
- Type
- *
isClient() → {boolean}
Returns true if ForerunnerDB is running on a client browser.
Returns:
- Type
- boolean
isClient() → {Boolean}
Checks if the database is running on a client (browser) or
a server (node.js).
Returns:
Returns true if running on a browser.
- Type
- Boolean
isServer() → {Boolean}
Checks if the database is running on a client (browser) or
a server (node.js).
Returns:
Returns true if running on a server.
- Type
- Boolean
isServer() → {boolean}
Returns true if ForerunnerDB is running on a server.
Returns:
- Type
- boolean
load(callbackopt)
Loads an entire database's data from persistent storage.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
function |
<optional> |
The method to call when the load function has completed. |
- Source:
load(callbackopt)
Loads an entire database's data from persistent storage.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
function |
<optional> |
The method to call when the load function has completed. |
- Source:
off(event, listener) → {*}
De-registers an event listener from an event name.
Parameters:
Name | Type | Description |
---|---|---|
event |
String | The name of the event to stop listening for. |
listener |
function | The listener method passed to on() when registering the event listener. |
Returns:
- Type
- *
oldView(viewName) → {*}
Gets a view by it's name.
Parameters:
Name | Type | Description |
---|---|---|
viewName |
String | The name of the view to retrieve. |
- Source:
Returns:
- Type
- *
oldViewExists(viewName) → {boolean}
Determine if a view with the passed name already exists.
Parameters:
Name | Type | Description |
---|---|---|
viewName |
String | The name of the view to check for. |
- Source:
Returns:
- Type
- boolean
oldViews() → {Array}
Returns an array of views the DB currently has.
- Source:
Returns:
An array of objects containing details of each view
the database is currently managing.
- Type
- Array
on(event, listener) → {*}
Registers an event listener against an event name.
Parameters:
Name | Type | Description |
---|---|---|
event |
String | The name of the event to listen for. |
listener |
function | The listener method to call when the event is fired. |
Returns:
- Type
- *
overviews() → {Array}
Returns an array of overviews the DB currently has.
- Source:
Returns:
An array of objects containing details of each overview
the database is currently managing.
- Type
- Array
peek(search) → {Array}
Find all documents across all collections in the database that match the passed
string or search object.
Parameters:
Name | Type | Description |
---|---|---|
search |
String or search object. |
Returns:
- Type
- Array
peekCat(search) → {object}
Find all documents across all collections in the database that match the passed
string or search object and return them in an object where each key is the name
of the collection that the document was matched in.
Parameters:
Name | Type | Description |
---|---|---|
search |
String or search object. |
Returns:
- Type
- object
save(callbackopt)
Saves an entire database's data to persistent storage.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
function |
<optional> |
The method to call when the save function has completed. |
- Source:
save(callbackopt)
Saves an entire database's data to persistent storage.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
function |
<optional> |
The method to call when the save function has completed. |
- Source:
version(val, callback) → {Boolean}
Checks version against the string passed and if it matches (or partially matches)
then the callback is called.
Parameters:
Name | Type | Description |
---|---|---|
val |
String | The version to check against. |
callback |
function | The callback to call if match is true. |
Returns:
- Type
- Boolean
view(viewName) → {*}
Gets a view by it's name.
Parameters:
Name | Type | Description |
---|---|---|
viewName |
String | The name of the view to retrieve. |
Returns:
- Type
- *
viewExists(viewName) → {boolean}
Determine if a view with the passed name already exists.
Parameters:
Name | Type | Description |
---|---|---|
viewName |
String | The name of the view to check for. |
Returns:
- Type
- boolean
views() → {Array}
Returns an array of views the DB currently has.
Returns:
An array of objects containing details of each view
the database is currently managing.
- Type
- Array