Node mongoose 封装 mongoosedao

码农软件 · 软件分类 · ORM/持久层框架 · 2019-09-23 17:57:09

软件介绍

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

本文地址:https://codercto.com/soft/d/15244.html

The Effective Engineer

The Effective Engineer

Edmond Lau / The Effective Bookshelf, Palo Alto, CA. / 2015-3-19 / USD 39.00

Introducing The Effective Engineer — the only book designed specifically for today's software engineers, based on extensive interviews with engineering leaders at top tech companies, and packed with h......一起来看看 《The Effective Engineer》 这本书的介绍吧!

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具