Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/mcollina/my-mongo-list
- Owner: mcollina
- License: mit
- Created: 2014-04-23T17:06:09.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-05-20T14:08:33.000Z (over 10 years ago)
- Last Synced: 2024-10-06T01:47:53.724Z (3 months ago)
- Language: JavaScript
- Size: 176 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.
Remove a todo list given an id.
## License
MIT