0.0.3 • Published 11 years ago

mong v0.0.3

Weekly downloads
18
License
MIT
Repository
github
Last release
11 years ago

mong

NPM Version Build Status Coverage Status NPM Downloads License

Simple models for mongodb objects.

npm install mong

Creating a collection class

var db = require('mong').create();

var User = module.exports = db.model('users');

User.prototype.getFullName = function () {
  return this.firstName + ' ' + this.lastName;
};

Then you can use the model:

db.connect('mongodb://localhost/mydatabase', function (err) {
  if (err) throw err;

  User.findOne({firstName: 'Anthony'}, function (err, doc) {
    console.log(doc.getFullName());
    doc.update({$inc: {count: 1}});
  });

  User
  .find()
  .on('data', function (user) {
    console.log(user.getFullName());
  })
  .on('end', function () {
    console.log('Node streams are cool!');
  });
});
2.0.2

10 years ago

2.0.1

10 years ago

2.0.0

10 years ago

1.1.0

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.11

11 years ago

0.0.10

11 years ago

0.0.9

11 years ago

0.0.8

11 years ago

0.0.7

11 years ago

0.0.6

11 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

12 years ago

0.0.0

12 years ago