Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var MongoClient = require('mongodb').MongoClient;
- const accountGetter = (accountCollection) => {
- return MongoClient.connect('mongodb://localhost:27017', (err, client)=>{
- if(err) return console.log(err)
- const db = client.db('papa')
- const collection = db.collection(accountCollection)
- collection.find({}).toArray((err, docs)=>{
- if(err)return console.log(err);
- console.log(docs)
- return docs
- })
- })
- }
- module.exports = accountGetter;
Add Comment
Please, Sign In to add comment