Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including mong with all npm packages installed. Try it out:

var mong = require("mong")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

mong v2.0.2

Lightweight models for mongodb objects


NPM Version Build Status Coverage Status NPM Downloads License

Simple models for mongodb objects.

npm install mong

Creating a collection class

var db = require('mong').create();

var User = module.exports = db.model('users');

User.prototype.getFullName = function () {
  return this.firstName + ' ' + this.lastName;

Then you can use the model:

db.connect('mongodb://localhost/mydatabase', function (err) {
  if (err) throw err;

  User.findOne({firstName: 'Anthony'}, function (err, doc) {
    doc.update({$inc: {count: 1}});

  .on('data', function (user) {
  .on('end', function () {
    console.log('Node streams are cool!');


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free