Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit cb952ea

Browse files
author
haydenyoung
committed
/value endpoint for counters. Available /query operator short-codes.
1 parent 36cb067 commit cb952ea

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

README.md

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,22 @@ curl http://localhost:3000/db/docstore
6565
{"address":{"root":"zdpuAmnfJZ6UTssG5Ns3o8ALXZJXVx5eTLTxf7gfFzHxurbJq","path":"docstore"},"dbname":"docstore","id":"/orbitdb/zdpuAmnfJZ6UTssG5Ns3o8ALXZJXVx5eTLTxf7gfFzHxurbJq/docstore","options":{"create":"true","indexBy":"_id","localOnly":false,"maxHistory":-1,"overwrite":true,"replicate":true},"type":"docstore"}
6666
```
6767

68+
### GET /db/:dbname/value
69+
70+
Gets the current value from counter database :dbname.
71+
72+
Returns the current counter value.
73+
74+
Can only be used on counter.
75+
76+
```shell
77+
curl -X GET http://localhost:3000/db/counter/value
78+
```
79+
80+
```json
81+
1
82+
```
83+
6884
### GET /db/:dbname/query
6985

7086
Queries the database :dbname.
@@ -90,21 +106,21 @@ curl http://localhost:3000/db/docstore/query -X GET -H "Content-Type: applicatio
90106
[{"project":"IPFS","site":"https://ipfs.io","likes":400}]
91107
```
92108

93-
Available operators are:
109+
Available operators short-codes are:
94110

95-
==
111+
```eq``` propname equals value. Equivalent to "=="
96112

97-
\>
113+
```gt``` propname is greater than value. Equivalent to ">"
98114

99-
<
115+
```lt``` propname is less than value. Equivalent to "<"
100116

101-
\>=
117+
```gte``` propname is greater than or equal to value. Equivalent to ">="
102118

103-
<=
119+
```lte``` propname is less than or equal to value. Equivalent to "<="
104120

105-
%
121+
```mod``` Perform a modulus calculation on propname using value. Equivalent to "%"
106122

107-
\*
123+
```all``` Fetch all records for field propname. Equivalent to "*"
108124

109125
### GET /db/:dbname/:item
110126

@@ -153,7 +169,7 @@ Gets items from an eventlog or feed database :dbname.
153169

154170
Returns a list of matching objects as a JSON array.
155171

156-
Can be only used on eventlog|feed.
172+
Can only be used on eventlog|feed.
157173

158174
```shell
159175
curl -X GET http://localhost:3000/db/feed/iterator
@@ -182,7 +198,7 @@ Adds a new entry to the eventlog or feed database :dbname.
182198

183199
Returns the multihash of the new record entry.
184200

185-
Can be only used on eventlog|feed
201+
Can only be used on eventlog|feed
186202

187203
```shell
188204
curl -X POST http://localhost:3000/db/feed/add -d 'feed-item-1'

0 commit comments

Comments
 (0)