tpc-dataservice
A simple MongoDB based Data Service utility.
Installation
npm install tpc-dataservice --save
Configuration
Setup the Environment
Set the environment variables
NODE_ENV=development
MONGODB_URI=mongodb://localhost:27017
SCHEMA_FILE=./resources/service.schema.js
SCHEMA_NAME=users
Usage
The usage of the data service utility is pretty straight forward.
var dataService=; //Connect to a databasedataService; //To get all entries from a collectiondataServiceall{ console;}; //To create a new entryvar entry=first_name:'John' last_name:'Smith';dataService; //To read an entryvar id=4815162342;dataService; //To update an entryvar id=4815162342;var updates=first_name:'John' last_name:'Doe';dataService; //To remove an entryvar id=4815162342;dataService;
That's all folks!