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 🙏

© 2025 – Pkg Stats / Ryan Hefner

momog

v1.0.5

Published

Mongoose Model Generator

Readme

#MoMoG Mongoose Model Generator as momog A small tool thats help to write mongoose model for mongodb as quick as possible for saving time, and not worry so much about writing model just think about it how it will be look like and just do it in a second.

##Installing

npm install -g momog

##Usage prefix of using it is momog

####The Options :

| option | stands for | | ------------- |:-------------:| | -n |name of the mode | | -f or --field | name of the field |
| -d or --directory| path to save model |

Types:

| Shortcut | stands for | | ------------- |:-------------:| | string |String| | num |Number|
| date |Date| | arr |Array| | id |ObjectId|

####Fields Name Shortcuts: | Shortcut | stands for | | ------------- |:-------------:| | r |required| | u |Unique|
| sf |not select| | def |default value| | ref |referrence to other model|

##Examples: We Want to create a basic user model with:

  • User name field thats string , required and of course sould be unique
  • Password thats should be string required and not unique also we don't need to select it in any query
  • PhoneNumber thats should be a string not required but unique and set default value for it 00000

Simply you will type

momog -n user -f username string r u -f password string r sf -f phonenumber num u def 00000

and will create

const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const userSchema = new Schema({
    username: {
        type: String,
        required: true,
        unique: true
    },
    password: {
        type: String,
        required: true,
        select: false
    },
    phonenumber: {
        type: Number,
        unique: true,
        default: '00000'
    }
});
module.exports = mongoose.model('User', userSchema);

also will generate file with this code in the same directory because we don't specified the directory called user.js

Another Example

we need to create article model with:

  • Title of type string thats should be unique and required
  • Content of the article also string and required
  • Date of the article
  • The Publisher we just need the id
momog -n article -f title string u r -f content string r -f date date r -f publisher id ref user -d models

will generate :

const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const articleSchema = new Schema({
    title: {
        type: String,
        unique: true,
        required: true
    },
    content: {
        type: String,
        required: true
    },
    date: {
        type: Date,
        required: true
    },
    publisher: {
        type: Schema.Types.ObjectId,
        ref: 'user'
    }
});
module.exports = mongoose.model('Article', articleSchema);

will generate file with this code in the directory ./models called article.js

##License: The MIT License