Skip to content

Instantly share code, notes, and snippets.

@cahlan
Created May 6, 2015 22:59
Show Gist options
  • Save cahlan/46c02a426ff82910ca15 to your computer and use it in GitHub Desktop.
Save cahlan/46c02a426ff82910ca15 to your computer and use it in GitHub Desktop.
var mongojs = require('mongojs');
var db = mongojs('test');
var users = db.collection('users');
//find all
// users.find(function(err, users) {
// console.log(err, users);
// });
//insert
// users.insert({name:'Jane', age:34, status:'inactive'}, function(err, new_user) {
// console.log(err, new_user);
// });
//find with more advanced operators
// users.find({age:{$gt:20}}, function(err, users) {
// console.log(users);
// })
//count
// users.count({age:{$gt:20}}, function(err, users) {
// console.log(users);
// })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment