Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. const findDocuments = function(db, callback) {
  2. // Koleksiyon, db objesinden alınır
  3. const collection = db.collection('employees');
  4.  
  5. // Id'si 3 olan kayıtı arama işlemi için: collection.find({ id: 3})
  6. // Tüm kayıtları listelemek: collection.find({}) şeklinde kullanabilirsiniz.
  7. collection.find({}).toArray(function(err, docs) {
  8. if(err) throw err;
  9.  
  10. console.log("Şu kayıtlar bulunmuştur;");
  11.  
  12. console.log(docs);
  13.  
  14. callback(docs);
  15. });
  16. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement