TyDB example

node v10.24.1
version: 1.0.0
endpointsharetweet
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