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 🙏

© 2024 – Pkg Stats / Ryan Hefner

egg-mongoose-datainit

v1.0.4

Published

egg-mongoose data init

Downloads

2

Readme

egg-mongoose-datainit

基于egg-mongoose的初始化数据导入插件,发布在公司私有npm仓库中,

安装

$ npm i egg-mongoose-datainit

使用

1、在config/plugin.js 中声明:

module.exports = {
  'mongoose-datainit': {
    enable: true,
    package: 'egg-mongoose-datainit',
  },
};

2、准备需要导入的数据:即 data/modelName.json 将需要导入的数据以数组格式置于.json文件中,再将.json文件放于项目根目录下的data文件夹中;其中json文件命名必须与model数据模型的modelName一致;

3、导入方式:insert、upsert、drop;在config.{env}.js里面做配置

'mongoose-datainit': {
 modelName: 'drop',  // upsert、drop
}
  • 插入insert:默认导入方式,可不做配置;即如果没有有该条数据,则插入该条数据,
  • 更新插入upsert:即如果有该条数据,则修改该条数据的值,没有则插入
  • 重置drop:即重置集合所有数据

说明:

  • egg-mongoose-datainit基于egg-mongoose,故在使用请确保egg-mongoose的所有配置皆已完善
  • egg-mongoose-datainit能够导入的前提为该集合的model已存在,并且data文件夹下有对应的json文件