Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
momog
Advanced tools
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 |
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:
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
we need to create article model with:
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
FAQs
Mongoose Model Generator
The npm package momog receives a total of 0 weekly downloads. As such, momog popularity was classified as not popular.
We found that momog demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.