npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

data-base-dao

v1.0.6

Published

NodeJS操作数据库的增删改查以及分页查询的api

Downloads

10

Readme

##使用: npm i -S data-base-dao

let db = require('data-base-dao')

001. 创建索引

######db.makeIndex(dataDaseName, collectionName, callback) ######参数说明: ######dataDaseName 数据库名 ######collectionName 集合名 ######callback 创建索引成功或失败的回调 参数为err,data(创建成功或失败的字符串文字描述)

002. 获取集合中的数据总个数

######db.getAllCount(dataDaseName, collectionName, data, callback) ######参数说明: ######dataDaseName 数据库名 ######collectionName 集合名 ######data 查询条件,格式为如{"age":15},如果查询所有就为{} ######callback 获取总数成功或失败的回调 参数为err,data(总个数)

003. 增(一次增加一条)

######db.insertOne(dataDaseName, collectionName, data, callback) ######参数说明: ######dataDaseName 数据库名 ######collectionName 集合名 ######data 要插入的文档 object ######callback 新增数据成功或失败的回调 参数为err,data

004. 删(批量删除)

######db.deleteMany(dataDaseName, collectionName, json, callback) ######参数说明: ######dataDaseName 数据库名 ######collectionName 集合名 ######json 要删除的文档的查询条件,object ######callback 删除数据成功或失败的回调 参数为err,data

005. 改(批量修改)

######db.updateMany(dataDaseName, collectionName, json1, json2, callback) ######参数说明: ######dataDaseName 数据库名 ######collectionName 集合名 ######json1 要修改的文档的查询条件,object ######json2 将通过json1查出来的文档改为什么样子,object ######callback 修改数据成功或失败的回调 参数为err,data

006. 查(普通查询)

######db.find(dataDaseName, collectionName, json, sort, callback) ######参数说明: ######dataDaseName 数据库名 ######collectionName 集合名 ######json 查询条件(查询全部可以写为{}),object ######sort {'字段名':-1} key为按照哪个字段进行排序,value中,-1为降序,1为升序 ######callback 查询数据成功或失败的回调 参数为err,data(data格式为{count:当前集合数据总量,result:符合本次查询条件返回的数据})

007. 查(分页查询)

######db.findPage(dataDaseName, collectionName, json, pageObj, sort, callback) ######参数说明: ######dataDaseName 数据库名 ######collectionName 集合名 ######json 查询条件(查询全部可以写为{}),object ######pageObj 是一个对象,即{everyPageNum:10,currentPage:1}每页的条目 和 当前页码,value为Number类型 ######sort {'字段名':-1} key为按照哪个字段进行排序,value中,-1为降序,1为升序 ######callback 查询数据成功或失败的回调 参数为err,data(data格式为{count:当前集合数据总量,result:符合本次查询条件返回的数据})