Published
Edited
Oct 15, 2021
Fork of lokiJS
2 stars
Also listed in…
API
Insert cell
Insert cell
//loki = require("https://cdnjs.cloudflare.com/ajax/libs/lokijs/1.5.12/lokijs.min.js")
loki = require(`lokijs@latest/build/lokijs.min.js`)
Insert cell
db = new loki('example.db');

Insert cell
users = db.addCollection('users');
Insert cell
{
users.insert({
name: 'Odin',
age: 50,
address: 'Asgard'
});
}
Insert cell
{
users.insert([{ name: 'Thor', age: 35}, { name: 'Loki', age: 30}]);
}
Insert cell
viewof found = Inputs.button("Find users", {
reduce: ()=>{
mutable results = users.find({ age: {'$gte': 35} });
}
})
Insert cell
mutable results = null
Insert cell
viewof findone = Inputs.button("find one", {
reduce: ()=>{
return users.findOne({ name:'Odin' });
}
})
Insert cell
findone
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more