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

mongoose-jsonform

v0.1.0

Published

mongoose-jsonform for generate jsonform json-schema directly from mongoose-schema.

Readme

mongoose-jsonform Build Status

NPM

NPM

jscov: 93%

This mongoose (schema) plugin purpose is to generate jsonform supported schemas.

Install

Install via npm

$ npm install mongoose-jsonform

Changeslog

  • 0.0.9 Fixed nested path bug (issue #1)
  • 0.0.8 Fixed DocumentArray and SchemaArray bug and added example express app
  • 0.0.7 added default value option from document (optional)
  • 0.0.6 added min,max and include/exclude paths support for number type and update usage example
  • 0.0.5 Update files related to test coverage
  • 0.0.4 Several fixes to mongoose-jsonform lib + added testcoverage-mocha tests
  • 0.0.3 Documentation updates
  • 0.0.2 Fixed pacakage.json and update readme
  • 0.0.1 First template-release

Optional mongoose-schema parameters for jsonform

Check from here: jsonform-common schema properties

Limitations

Not supported schema types

  • Mixed
  • is not unambiguous
  • Buffer
  • What kind of form this Buffer should be? If you have idea, please let me know.
  • Maybe File?
  • integer (jsonform support, but mongoose not)

Usage

var jsonform = require('mongoose-jsonform');
var mongoose = require('mongoose');
var Schema = mongoose.Schema;

var BlogSchema = new Schema({
  title:  {type: String, required: true,
    //These keys are just for jsonform. Mongoose not support these keys. 
    title: 'Blog title',
    description: 'Title for a Blog',
    maxLength: 100
  },
  author: String,
  body:   String,
  comments: [{ body: String, date: Date }],
  date: { type: Date, default: Date.now },
  hidden: Boolean,
  meta: {
    votes: Number,
    favs:  Number
  }
});
BlogSchema.plugin( jsonform, {
  excludedPaths: ['_id', '__v'] //these paths are generally exceluded
} );
var Blog = mongoose.model('Blog', BlogSchema);
var doc = new Blog({author: 'me'});
var out = doc.jsonform({
  includes: ['title', 'body', 'author'] //only these paths are included in json schema
  //excludes:['_id', '__v'], //alternative we could set excluded paths
});
console.log( JSON.stringify(out, null, '  ') );

License

(The MIT License)

Copyright (c) 2013 jussiva <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.