Advertisement
Guest User

Untitled

a guest
Jan 25th, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. var MongoClient = require('mongodb').MongoClient;
  2. MongoClient.connect('mongodb://localhost:27017/school', function(err, db){
  3. if (err) throw err;
  4. var students = db.collection('students');
  5. var cursor = students.find({'scores.type':'homework'});
  6. cursor.sort('score', 1);
  7. cursor.each()(function(err, doc){
  8. if(err) throw err;
  9. console.dir(doc);
  10. })
  11. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement