InvoDB/demo/test.js

22 lines
579 B
JavaScript
Raw Normal View History

2021-11-12 15:58:21 +08:00
const invodb = require('..')
invodb.database('zzz.invodb')
let col = invodb.colection('blog')
if(!col.exist()) col.create();
2021-11-13 12:53:14 +08:00
for(let i=0; i<1; i++) {
col.insert({ id: "1s", title: "第一篇文章", author: "YuhangQ"})
col.insert({ id: "2s", title: "第二篇文章", author: "Ciel"})
col.insert({ id: "3s", title: "第三篇文章", author: "YuhangQ"})
col.insert({ id: "4s", title: "第四篇文章", author: "By"})
}
2021-11-12 15:58:21 +08:00
2021-11-13 12:53:14 +08:00
let result = col.query({id: {}})
2021-11-12 15:58:21 +08:00
2021-11-13 12:53:14 +08:00
// for(let json of result) {
// col.remove(json)
// }
console.log(result)
console.log(result.length)