mongo_keyval
simple key-value store api on top of mongodb
Install
npm install mongo_keyval
Using
Setting a value. Value can be anything that is JSON-serializable: string, array, object
var keyval = keyvalkeyval
Can optionally provide a callback to be called when setting is complete:
keyval
Use get to get values:
keyval
Mongo details
If using Heroku, your mongo url will automatically be used, from the following sources:
- process.env.MONGOHQ_URL
- process.env.MONGOLAB_URI
- process.env.MONGOSOUP_URL
Otherwise, the default url will be the local mongo instance:
- mongodb://localhost:27017/default
You can manually specify the mongo URL by setting mongo_keyval.mongourl
Values are stored in the collection 'vars' under the key specified.
You can manually specify the collection name by setting mongo_keyval.collection