You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 4, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: docs/DATABASE.md
+37Lines changed: 37 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -163,6 +163,9 @@ Firebase supports querying data and this plugin does too, since v2.0.0.
163
163
164
164
Let's say we have the structure as defined at `setValue`, then use this query to retrieve the companies in country 'Bulgaria':
165
165
166
+
<details>
167
+
<summary>Native API</summary>
168
+
166
169
```js
167
170
varonQueryEvent=function(result) {
168
171
// note that the query returns 1 match at a time
@@ -216,6 +219,40 @@ Let's say we have the structure as defined at `setValue`, then use this query to
216
219
```
217
220
218
221
For supported values of the orderBy/range/ranges/limit's `type` properties, take a look at the [`firebase-common.d.ts`](firebase-common.d.ts) TypeScript definitions in this repo.
222
+
</details>
223
+
<details>
224
+
<summary>Web API</summary>
225
+
226
+
Alternatively you can use the web api to query data. See [docs](https://firebase.google.com/docs/reference/js/firebase.database.Query) for more examples and the full api
227
+
228
+
Some key notes:
229
+
230
+
`off("eventType")` will remove all listeners for "eventType" at the given path. So you do not need to call `off()`
231
+
the same number of times you call `on()`. Listeners for all eventTypes will be removed if no eventType is provided.
232
+
233
+
Filters (equalTo, starAt, endAt, LimitBy, etc) are only usable after you chain it with a sort. (While Firebase exposes these without doing
234
+
a sort, your callback is never called). Think about it, if you apply equalTo without an orderBy what are you checking key, value, priority ???
235
+
236
+
DO NOT try to apply more than one orderBy to the same query as this will throw (follows the api)
237
+
```typescript
238
+
const bad =firebaseWebApi.database().ref(path).orderByKey();
0 commit comments