Skip to content

Commit ea44fbf

Browse files
committed
0.3.1
1 parent 06da53c commit ea44fbf

File tree

7 files changed

+20
-15
lines changed

7 files changed

+20
-15
lines changed

README.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,20 @@ DnDB is an incredibly fast and powerful data store. All methods are streamed and
3939
## 🧪 Quick test
4040

4141
[Run the demo](/demo/README.md) to test DnDB in a server environment.
42+
Also this demo lives on [Codesandbox](https://codesandbox.io/s/6x0uw)
4243

4344
## 📦 Importing
4445

4546
**deno.land**
4647

4748
```javascript
48-
import Datastore from 'https://deno.land/x/dndb@0.3.0/mod.ts'
49+
import Datastore from 'https://deno.land/x/dndb@0.3.1/mod.ts'
4950
```
5051

5152
**nest.land**
5253

5354
```javascript
54-
import Datastore from 'https://x.nest.land/dndb@0.3.0/mod.ts'
55+
import Datastore from 'https://x.nest.land/dndb@0.3.1/mod.ts'
5556
```
5657

5758

@@ -71,7 +72,7 @@ All the api methods are asynchronous by default, so they return promises, but it
7172
## ✔️ Instantiating the collection
7273

7374
```javascript
74-
import Datastore from 'https://deno.land/x/dndb@0.3.0/mod.ts'
75+
import Datastore from 'https://deno.land/x/dndb@0.3.1/mod.ts'
7576

7677
const db = new Datastore({ filename:"./database.db", autoload: true })
7778

@@ -253,9 +254,12 @@ await remove({ _id: 'id2' })
253254

254255
> *Notice*: If you want to unset a value from the document you must use update with the $unset operator. See all rules and operators list [here](https://www.npmjs.com/package/mingo)
255256
256-
# 📝 TO DO
257-
258-
- Event hooks on all the api usage
257+
# 📝 Roadmap
258+
- Standard methods
259+
- Database from datastores factory
260+
- Read and write streams and buffer
261+
- Global Queue executor
262+
- Event hooks on all the API usage
259263
- Count method
260264
- Improve documentation
261265
- Prevent updating immutable data

demo/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ This demo shows you how to use DnDB in a backend environment.
44

55
## Steps
66

7+
- Download this folder
78
- Run the demo with the permission flags.
89

910
```bash
10-
deno run -A --unstable https://x.nest.land/dndb/0.2.7/demo/mod.js
11+
deno run -A --unstable https://deno.land/x/dndb@0.3.1/demo/mod.js
1112
```
1213

1314
You can start playing with the new demo UI. Fist try to insert a document typing an username and clicking 'Make Query'.

deps.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import mongobj from "https://cdn.skypack.dev/mongobj"
1+
import updater from "https://cdn.skypack.dev/mongobj"
22
import { matches } from 'https://raw.githubusercontent.com/denyncrawford/safe-filter/master/dist/index.js'
33
import project from 'https://raw.githubusercontent.com/denyncrawford/mongo-project.node/master/dist/bundle.js'
44
import { EventEmitter } from "https://deno.land/std/node/events.ts";
@@ -7,7 +7,7 @@ import { existsSync } from "https://deno.land/std/fs/mod.ts";
77
import { resolve, dirname, join } from 'https://deno.land/std/path/mod.ts';
88

99
export {
10-
mongobj,
10+
updater,
1111
matches,
1212
project,
1313
EventEmitter,

egg.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "A Deno 🦕 persistent database for JS & TS",
44
"stable": true,
55
"entry": "./mod.ts",
6-
"version": "0.3.0",
6+
"version": "0.3.1",
77
"repository": "https://github.com/denyncrawford/dndb",
88
"files": [
99
"./mod.ts",

src/executor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default class Executor {
77
this.queue.push(async () => {
88
const finished = await method(...params);
99
res(finished);
10-
if (typeof finished === "undefined" || finished) this.next();
10+
if (typeof finished === "undefined" || finished === null || finished) this.next();
1111
});
1212
if(!this.running) this.next();
1313
})

src/methods/update.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { mongobj, matches } from '../../deps.ts';
1+
import { updater, matches } from '../../deps.ts';
22
import { ReadFileStream, WriteFileStream } from '../storage.ts';
33

44
export default async (filename ,query, operators, bufSize) => {
@@ -9,7 +9,7 @@ export default async (filename ,query, operators, bufSize) => {
99
return new Promise((resolve, reject) => {
1010
readStream.on('document', obj => {
1111
if (matches(query, obj)) {
12-
mongobj.update(obj, operators);
12+
updater.update(obj, operators);
1313
updated.push(obj)
1414
}
1515
writeStream.write(obj)

src/methods/updateOne.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { mongobj, matches } from '../../deps.ts';
1+
import { updater, matches } from '../../deps.ts';
22
import { ReadFileStream, WriteFileStream } from '../storage.ts';
33
import Executor from '../executor.ts'
44

@@ -10,7 +10,7 @@ export default async (filename ,query, operators, bufSize) => {
1010
return new Promise((resolve, reject) => {
1111
readStream.on('document', async obj => {
1212
if (matches(query, obj) && !updated.length) {
13-
mongobj.update(obj, operators);
13+
updater.update(obj, operators);
1414
updated.push(obj)
1515
}
1616
writeStream.write(obj)

0 commit comments

Comments
 (0)