dobo 1.2.4 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/bajo/intl/en-US.json +1 -1
- package/docs/query-language.md +152 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,6 +18,22 @@ $ npm install dobo
|
|
|
18
18
|
|
|
19
19
|
Now open your ```<bajo-data-dir>/config/.plugins``` and put ```dobo``` in it
|
|
20
20
|
|
|
21
|
+
## Documentations
|
|
22
|
+
|
|
23
|
+
- [Query Language](docs/query-language.md)
|
|
24
|
+
|
|
25
|
+
## Database Drivers
|
|
26
|
+
|
|
27
|
+
- Memory (Built-in)
|
|
28
|
+
- [SQL/Knex](https://github.com/ardhi/dobo-knex)
|
|
29
|
+
- [CouchDB](https://github.com/ardhi/dobo-couchdb)
|
|
30
|
+
- [Elasticsearch](https://github.com/ardhi/dobo-elasticsearch)
|
|
31
|
+
- [MongoDB](https://github.com/ardhi/dobo-mongodb)
|
|
32
|
+
- [Redis](https://github.com/ardhi/dobo-redis)
|
|
33
|
+
- [REST Proxy](https://github.com/ardhi/dobo-restproxy)
|
|
34
|
+
|
|
35
|
+
More will come soon
|
|
36
|
+
|
|
21
37
|
## License
|
|
22
38
|
|
|
23
39
|
[MIT](LICENSE)
|
package/bajo/intl/en-US.json
CHANGED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# Query Language
|
|
2
|
+
|
|
3
|
+
Since *dobo* use [Ghost QL](https://github.com/TryGhost/NQL) for its query language, you have the option to pick one of these syntaxes:
|
|
4
|
+
|
|
5
|
+
- [NQL](https://github.com/TryGhost/NQL/tree/main/packages/nql)
|
|
6
|
+
- [Mongo QL](https://www.mongodb.com/docs/manual/tutorial/query-documents/)
|
|
7
|
+
|
|
8
|
+
Any NQL statements will be converted to MongoDB-like QL object first, this then passed down to the database's native QL provided by its driver.
|
|
9
|
+
|
|
10
|
+
Examples from [NQL test suite](https://github.com/TryGhost/NQL/blob/main/packages/nql-lang/test/parser.test.js):
|
|
11
|
+
|
|
12
|
+
## Equals
|
|
13
|
+
|
|
14
|
+
count:5
|
|
15
|
+
```javascript
|
|
16
|
+
{ count: 5 }
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
slug:getting-started
|
|
20
|
+
```javascript
|
|
21
|
+
{ slug: 'getting-started' }
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
author:'Joe Bloggs'
|
|
25
|
+
```javascript
|
|
26
|
+
{ author: 'Joe Bloggs' }
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Not Equals
|
|
30
|
+
count:-5
|
|
31
|
+
```javascript
|
|
32
|
+
{ count: { $ne: 5 } }
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
author:-'Joe Bloggs'
|
|
36
|
+
```javascript
|
|
37
|
+
{ author: { $ne: 'Joe Bloggs' } }
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Less/Greater Than or Equals
|
|
41
|
+
|
|
42
|
+
count:>5
|
|
43
|
+
```javascript
|
|
44
|
+
{ count: { $gt: 5 } }
|
|
45
|
+
```
|
|
46
|
+
tag:<getting-started
|
|
47
|
+
```javascript
|
|
48
|
+
{ tag: { $lt: 'getting-started' } }
|
|
49
|
+
```
|
|
50
|
+
count:>=5
|
|
51
|
+
```javascript
|
|
52
|
+
{ count: { $gte: 5 } }
|
|
53
|
+
```
|
|
54
|
+
author:<=\'Joe Bloggs\'
|
|
55
|
+
```javascript
|
|
56
|
+
{ author: { $lte: 'Joe Bloggs' } }
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## IN or NOT IN, single or multiple value
|
|
60
|
+
|
|
61
|
+
count:[5]
|
|
62
|
+
```javascript
|
|
63
|
+
{ count: { $in: [5] } }
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
tag:-[getting-started]
|
|
67
|
+
```javascript
|
|
68
|
+
{ tag: { $nin: ['getting-started'] } }
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
author:-['Joe Bloggs', 'John O\\'Nolan', 'Hello World']
|
|
72
|
+
```javascript
|
|
73
|
+
{ author: { $nin: ['Joe Bloggs', 'John O\'Nolan', 'Hello World'] } }
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## CONTAINS, STARTSWITH and ENDSWITH with and without NOT
|
|
77
|
+
|
|
78
|
+
email:~'gmail.com'
|
|
79
|
+
```javascript
|
|
80
|
+
{ email: { $regex: /gmail\.com/i } }
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
email:-~'gmail.com'
|
|
84
|
+
```javascript
|
|
85
|
+
{ email: { $not: /gmail\.com/i } }
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
email:~^'gmail.com'
|
|
89
|
+
```javascript
|
|
90
|
+
{ email: { $regex: /^gmail\.com/i } }
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
email:-~^'gmail.com'
|
|
94
|
+
```javascript
|
|
95
|
+
{ email: { $not: /^gmail\.com/i } }
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
email:~$'gmail.com'
|
|
99
|
+
```javascript
|
|
100
|
+
{ email: { $regex: /gmail\.com$/i } }
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
email:-~$'gmail.com'
|
|
104
|
+
```javascript
|
|
105
|
+
{ email: { $not: /gmail\.com$/i } }
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## NULL and Boolean Value
|
|
109
|
+
|
|
110
|
+
image:null
|
|
111
|
+
```javascript
|
|
112
|
+
{ image: null }
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
featured:false
|
|
116
|
+
```javascript
|
|
117
|
+
{ featured: false } }
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
featured:-true
|
|
121
|
+
```javascript
|
|
122
|
+
{ featured: { $ne: true } }
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Logical Operators
|
|
126
|
+
|
|
127
|
+
page:false+status:published
|
|
128
|
+
```javascript
|
|
129
|
+
{ $and: [{ page: false }, { status: 'published' }] }
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
page:true,featured:true
|
|
133
|
+
```javascript
|
|
134
|
+
{ $or: [{ page: true }, { featured: true }] }
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Groups/ungroups
|
|
138
|
+
|
|
139
|
+
(page:false,(status:published+featured:true))
|
|
140
|
+
```javascript
|
|
141
|
+
{
|
|
142
|
+
$or: [
|
|
143
|
+
{ page: false },
|
|
144
|
+
{
|
|
145
|
+
$and: [
|
|
146
|
+
{status: 'published'},
|
|
147
|
+
{featured: true}
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
```
|