mongoosedao - Node mongoose 封装


MIT
跨平台
JavaScript

软件简介

mongoosedao = mongoose data access object

mongoosedao 是基于 node Mongoose 封装的对
MongoDB 的 crud 等数据访问对象,和 Java 里的 dao
比较相似,可以提高开发效率。

安装

npm install --save mongoosedao

使用

require('./db');

var User = require('./User');

User.create({"username":"sss","password":"password"},function(err, user){
  console.log(user);
});

User.delete({"username":"sss","password":"password"},function(err, user){
  console.log(user);
});

API and Test

Test status

  • create

  • delete = remove

  • deleteAll = removeAll

  • deleteById = removeById

  • getById

  • all = getAll = find({})

  • query = getByQuery = find

  • one = findOne

  • update

  • updateOne

  • updateById

  • pageByLastId

  • top(num) && first(num) = n(num) = latest(num)

  • count(cb) &* count({},cb)

more see api doc