Skip to content
/ mangos Public

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

Notifications You must be signed in to change notification settings

jcblw/mangos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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()

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published