Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mcollina/my-mongo-list

A simple todo-list module built on mongodb
https://github.com/mcollina/my-mongo-list

Last synced: 2 months ago
JSON representation

A simple todo-list module built on mongodb

Awesome Lists containing this project

README

        

my-mongo-list
=============

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

## Install

```bash
npm install my-mongo-list mongodb --save
```

## Example

```js
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
* mongolist.load
* mongolist.remove


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

Saves a todo list.
The err object is generated by [Joi](http://npm.im/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