Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

my-mongo-list

0.0.0 • Public • Published

my-mongo-list

A simple todo-list module built on top of mongodb.

Install

npm install my-mongo-list mongodb --save

Example

var mongoList = require("my-mongo-list");
var mongoURL = "mongodb://localhost:27017/mongolisttest";
var MongoClient = require("mongodb").MongoClient;
 
MongoClient.connect(db, { w: 1 }, function(err, db) {
  var mylist = mongoList(db);
 
  mylist.save({
    name: "hello world",
    items: [{
      name: "aaaa"
    }]
  }, function(err, list) {
    console.log(err, list);
  });
});

API

mongolist.save(list, cb(err, saved))

Saves a todo list. The err object is generated by Joi to support validations. The id of the todo list will be in the saved._id property.

mongolist.load(id, cb(err, list))

Load a todo list given an id.

mongolist.remove(id)

Remove a todo list given an id.

License

MIT

Keywords

none

Install

npm i my-mongo-list

DownloadsWeekly Downloads

0

Version

0.0.0

License

MIT

Last publish

Collaborators

  • avatar