Ich bin versuchen, meine ausgehende DB in Lokijs verwenden, aber meine autoloadcallback Dosis nicht mit console.log ('von add collection don') zu wissen, wenn es feuert, aber es nie Dosis und wenn ich versuche hinzuzufügen Daten db es nur nicht funktioniert, wenn ich meine Sammlung VariableLokijs autoloadcallbake nicht woking
var user = null
db = new loki("myuser.json",{adapter: adapter}, {
autosave: true,
autosaveInterval: 5000,
autoload: true,
autoloadCallback: function(){
db_ready = true;
console.log('from add collection don')
if(db.getCollection("myaccount") == null){
myusers = db.addCollection("myaccount");
}
}
});
function py_userlogin(username,password,islogin){
myusers.insert({
username:username,
password:password,
islogin:islogin
},function(err,don){
console.log(JSON.stringify(err) + JSON.stringify(don))
});
console.log(myusers.data);
db.saveDatabase();
}