Module: meta-data/mongo-storage

Copyright 2015 Randal L Kamradt Sr. Mongo Storage.
Source:

(require("meta-data/mongo-storage"))(model, url, collectionName) → {Object}

A store API backed by mongo database
Parameters:
Name Type Description
model Object The model description
url String The Mongo URL
collectionName String The Mongo Collection
Source:
Returns:
The API Object
Type
Object

Methods

(inner) add(d, done)

add an item to the store
Parameters:
Name Type Description
d Object The item to store
done function The callback when done
Source:

(inner) find(key, done)

return an item by id
Parameters:
Name Type Description
key String The key value
done function The callback when done
Source:

(inner) findAll(done)

return the entire store as an Array
Parameters:
Name Type Description
done function The callback when done
Source:

(inner) load(d, done)

load an array of data into a store
Parameters:
Name Type Description
d Array The data to load
done function The callback when done
Source:

(inner) remove(key, done)

Remove an item by key
Parameters:
Name Type Description
key String The key value
done function The callback when done
Source:

(inner) update(data, done)

update an item by id
Parameters:
Name Type Description
data String The new data
done function The callback when done
Source: