• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import { EJDB2 } from 'ejdb2_node';
2
3async function run() {
4  const db = await EJDB2.open('example.db', { truncate: true });
5
6  var id = await db.put('parrots', {'name': 'Bianca', 'age': 4});
7  console.log(`Bianca record: ${id}`);
8
9  id = await db.put('parrots', {'name': 'Darko', 'age': 8});
10  console.log(`Darko record: ${id}`);
11
12  const q = db.createQuery('/[age > :age]', 'parrots');
13
14  for await (const doc of q.setNumber('age', 3).stream()) {
15    console.log(`Found ${doc}`);
16  }
17
18  await db.close();
19}
20
21run();
22