var database = require("./db.js"); database.init(); // database.put('namezzzzzz', {asd: "gdfhdfh"}, function (err) { // if (err) return console.log('Ooops!', err) // some kind of I/O error // // 3) Fetch by key // database.get('namezzzzzz', function (err, value) { // if (err) return console.log('Ooops!', err) // likely the key was not found // // Ta da! // console.log('name is=' + JSON.stringify(value)) // }) // }) database.put('asdad', {username: "nik"}). then(() => database.put('asdad2', {username: "nik2"})). then(() => database.put('asdad3', {username: "nik3"})). then(() => database.put('asdad4', {username: "nik4"})). then(() => database.put('asdad5', {username: "nik5"})).then(function(value){ return database.get('naaa'); }).//then(console.log). then(() => { database.index.search(['username', 'dimos'])//.on('data', (a) => console.log(a)) .then(console.log); }) .catch(console.log);