Methods
- (static) collection(collectionName, primaryKey) → {Collection}
- (static) collection(collectionName, primaryKey, options) → {Collection}
- (static) collection(data) → {Collection}
- (static) collection(collectionName, options) → {Collection}
- (static) collection(collectionName) → {Collection}
- (static) collection() → {Collection}
- (static) collectionGroup(name) → {*}
- (static) document() → {Document}
- (static) document(data) → {Document}
- (static) document(documentName) → {Document}
- (static) document(documentName, options) → {Document}
- (static) documents() → {Array}
- (static) drop(callback)
- (static) drop()
- (static) drop(removePersist)
- (static) drop(removePersist, callback)
- (static) grid(selector, template, optionsopt) → {*}
- (static) gridExists(selector) → {boolean}
- (static) grids() → {Array}
- (static) load(callbackopt)
- (static) load(myData, callback)
- (static) moduleLoaded(moduleName) → {Boolean}
- (static) moduleLoaded(moduleName, callback)
- (static) moduleLoaded(moduleName, success, failure)
- (static) save(options, callback)
- (static) save(callbackopt)
- (static) unGrid(selector, template, optionsopt) → {*}
- arrayToCollection(arr) → {Collection}
- collectionExists(viewName) → {boolean}
- collectionGroups() → {Array}
- collections(search) → {Array}
- isClient() → {boolean}
- isClient() → {Boolean}
- isServer() → {boolean}
- isServer() → {Boolean}
- load(callbackopt)
- oldView(viewName) → {*}
- oldViewExists(viewName) → {boolean}
- oldViews() → {Array}
- overview(name) → {*}
- overviews() → {Array}
- peek(search) → {Array}
- peek(event, dataopt) → {*}
- peekCat(search) → {Object}
- persistedSize(callback)
- procedure(name, methodopt) → {*}
- save(callbackopt)
- sectionEnter()
- sectionLeave()
- version(val, callback) → {Boolean}
- view(name) → {*}
- viewExists(name) → {boolean}
- views() → {Array}
(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, 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(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) 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) → {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() → {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.
- Source:
Returns:
- Type
- Collection
(static) collectionGroup(name) → {*}
Creates a new collectionGroup instance or returns an existing
instance if one already exists with the passed name.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String | The name of the instance. |
- Source:
Returns:
- Type
- *
(static) document() → {Document}
Get a document with no name (generates a random name). If the
document does not already exist then one is created for that
name automatically.
- Source:
Returns:
- Type
- Document
(static) document(data) → {Document}
Get a document by name. If the document does not already exist
then one is created for that name automatically.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Object | An options object or a document instance. |
- Source:
Returns:
- Type
- Document
(static) document(documentName) → {Document}
Get a document by name. If the document does not already exist
then one is created for that name automatically.
Parameters:
| Name | Type | Description |
|---|---|---|
documentName |
String | The name of the document. |
- Source:
Returns:
- Type
- Document
(static) document(documentName, options) → {Document}
Get a document by name. If the document does not already exist
then one is created for that name automatically.
Parameters:
| Name | Type | Description |
|---|---|---|
documentName |
String | The name of the document. |
options |
Object | An options object. |
- Source:
Returns:
- Type
- Document
(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(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) 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) 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) 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:
(static) load(myData, callback)
Loads an entire database's data from persistent storage.
Parameters:
| Name | Type | Description |
|---|---|---|
myData |
Object | Custom data to load into the collection. |
callback |
function | The method to call when the load function has completed. |
- Source:
(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) 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, 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) save(options, callback)
Saves an entire database's data to persistent storage.
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object | The options object. |
callback |
function | The method to call when the save function has completed. |
- Source:
(static) 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:
(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
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}
Returns true if ForerunnerDB is running on a server.
Returns:
- 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
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:
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
overview(name) → {*}
Create an overview instance from a Db instance.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String | The name of the overview. |
- Source:
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
peek(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
- *
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
persistedSize(callback)
Determines the byte size of a persisted DB
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
persistedSizeCallback | The method to call when the size check is complete |
- Source:
procedure(name, methodopt) → {*}
Create or retrieve a procedure by name.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
name |
String | The name of the procedure. | |
method |
function |
<optional> |
If specified, creates a new procedure with the provided name and method. |
- Source:
Returns:
- Type
- *
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:
sectionEnter()
Denotes a section has been entered. All instances created
after this call will be assigned to this "section".
- Source:
sectionLeave()
Denotes a section has been left. All instances that were
created during the section lifespan will be automatically
dropped.
- 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(name) → {*}
Gets a view by it's name.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String | The name of the view to retrieve. |
Returns:
- Type
- *
viewExists(name) → {boolean}
Determine if a view with the passed name already exists.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
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