Answer the question
In order to leave comments, you need to log in
How to bypass js event model?
There was such a question coming from the logic of js, I don’t know how to get around it
var readMacs = function(collection) {
var macs;
MongoClient.connect('mongodb://127.0.0.1:27017/snmp', function(err, db) {
if (err) throw err;
db.collection(collection).distinct('mac', function(err, docs) {
console.log(docs);
db.close();
return docs;
})
});
};
console.log(readMacs('allowedmacs'));
undefined
[ '111a.468a.4985',
'12aa.468a.4444',
'14aa.468a.4444',
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question