I'm a NodeJS beginner and actually I try to work with a NoSQL Database for building a simple login via. Digest Authentication. I also created an module called "users" wich is loaded in my application.
Now when I try to call the data results inside the callback function I get my correct data. In the same callback I assign the returned data to the variable records. When I call the variable outside I will get the result null - where is the error?
var dbdriver = require('nosql'),
dbfile = dbdriver.load("./db.nosql"),
records = null
dbfile.top(1000).callback(function(err, response) {
(function(users) {
records = users
console.log(users) // Here i get the wanted result
})(response)
})
console.log(records) // Here the result is empty
thank you very much :)