Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
TyDB example
node v10.24.1
version:
1.0.0
endpoint
share
tweet
var tydb = require("tydb"); var BaseModel = tydb.BaseModel; // define your model // you documents will be mapped // according to this model class MyModel extends BaseModel { constructor() { super(); // defaults this.name = ""; this.male = false; } get female() { return !this.male; } } let myDB = new tydb.Database({ ref: "mydb", model: MyModel }); (async ()=>{ await myDB.insert([MyModel.new({ name: "alex", male: true })]); await myDB.insert([MyModel.new({ name: "dina", male: false })]); console.log(await myDB.find({filter: { female: { $eq: false } }})) })();
Created from: https://npm.runkit.com/tydb
Loading…
no comments
sign in
to comment