db.test.js 711 B

123456789101112131415
  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" , test: {deep:1, spec: 2}})).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. let a = database.index.createSearchStream(['test', 'deep', 1]).on('data', (a) => console.log(a));
  13. })
  14. .catch(console.log);