-
Notifications
You must be signed in to change notification settings - Fork 0
Retrieving data
Auguste Rame edited this page Oct 8, 2019
·
2 revisions
Data in streamlet can be accessed via the following commands: Retrieving
let db = new streamlet(path.join(__dirname, 'db.sl'))
async () => {
await db.init()
db.get(0) // {item: 'foo', number: 1}
}
Will Get the n
th non deleted item in the database
let db = new streamlet(path.join(__dirname, 'db.sl'))
async () => {
await db.init()
await db.find(i => {return i.name === 'bar'?i:undefined}) // {item: 'bar', number: 2}
}
db.find
will return all items which can be iterated over in a function
let db = new streamlet(path.join(__dirname, 'db.sl'))
async () => {
await db.init()
await db.findById(`hFkEXrkuRyGQAf8t7vzshw/0000000000`) // {item: 'foo', number: 1}
}
This will find an item by its auto assigned _id
???
???