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 mangos with all npm packages installed. Try it out:

var mangos = require("mangos")

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

mangos v0.1.3

Mangos.js is a simple module to make MongoDB syntax CRUD. It uses and exposes controls straight from MongoDB's Native driver

Mangos

mango_js is now mangos

Mangos.js is a simple module to make MongoDB syntax CRUD. It uses and exposes controls straight from MongoDB's Native driver

Documentation in the code!

Install

npm install mangos

you can install it locally for development by doing this

git clone https://github.com/jacoblwe20/mango_js.git
cd ~/your_app
npm install ../mango_js

then in your code

// to include
var Mangos = require('mangos');
//to use
var userSet = new Mangos('users', 'localhost', 27017);
// or with a mongo uri
var locations = new Mangos('locations', 'mongodb://admin:supersecret@cooldbs.io/yourdb');
// Dont do this the code is not synchronous
userSet.create({name : 'Jacob'}, function(err, user){
  // if no error user is created
  console.log(user._id);
});

userSet.read({name : 'Jacob'},function(err, users){
  console.log(users); // array of users with Jacob as name
});

userSet.update({id : '50e3bdb52fc1c5d15a000001', status : 'active'}, function(err, user){
  // if no err user is updated
});

userSet.delete('50e3bdb52fc1c5d15a000001', function(err, user){
  // if no error user is deleted
});

Not enough control... well you can still use the native driver

userSet.db.open()
// Mongo Db Native Driver Object
userSet.db.collectionNames(function(err, names){
    console.log(names);
});
userSet.db.close()

Metadata

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