db.test.js 581 B

1234567891011121314
  1. var database = require("./db.js");
  2. database.init();
  3. database.put('naaa', {username: "nik"}).
  4. then(() => database.put('asdad2', {username: "nik2"})).
  5. then(() => database.put('asdad3', {username: "nik3"})).
  6. then(() => database.put('asdad4', {username: "nik4"})).
  7. then(() => database.put('asdad5', {username: "nik5"})).then(function(value){
  8. return database.get('dasnaaa').catch((e)=>console.log(e.name === "NotFoundError"));
  9. }).then(console.log).
  10. then(() => {
  11. let a = database.index.createSearchStream(['username', 'nik']).on('data', (a) => console.log(a));
  12. })
  13. .catch(console.log);