Skip to content

Commit 3c08b19

Browse files
committed
docs: rtdb rename to database
1 parent 382ade7 commit 3c08b19

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

docs/cookbook/migration-v2-v3.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ const usersRef = collection(db, 'users').withConverter({
8888

8989
The `$bind` method is now called `$firestoreBind` to avoid conflicts with other libraries. In the same way, `$unbind` is now called `$firestoreUnbind`.
9090

91-
The `$rtdbBind` and `$rtdbUnbind` methods are unchanged.
91+
### Rename `$rtdbBind` to `$databaseBind`
92+
93+
The `$rtdbBind` method is now called `$databaseBind` to have a consistent naming that aligns with the Firebase SDK. In the same way, `$rtdbUnbind` is now called `$databaseUnbind`.
94+
95+
Note that for compatibility reasons, the `$rtdbBind` and `$rtdbUnbind` methods are still available but marked as deprecated.
9296

9397
## Vuexfire
9498

docs/guide/options-api-realtime-data.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This pages assumes you have read the [Realtime Data](./realtime-data.md) page an
77
There are two ways of using Realtime Data with VueFire:
88

99
- Declarative binding with the `firebase`/`firestore` option
10-
- Programmatic binding with the injected methods `$rtdbBind`/`$firestoreBind`
10+
- Programmatic binding with the injected methods `$databaseBind`/`$firestoreBind`
1111

1212
Once you _bind_, VueFire will keep the local version synchronized with the remote Database. However, this synchronization **is only one-way**. Do not modify the local variable (e.g. doing `this.user.name = 'John'`), because (a) it will not change the remote Database and (b) it can be overwritten at any time by VueFire. To [write changes to the Database](./writing-data.md), use the Firebase JS SDK. In other words, **treat the local variable as read-only**.
1313

@@ -76,7 +76,7 @@ You must declare properties with their initial values in `data`. **For the RTDB,
7676

7777
## Programmatic binding
7878

79-
If you need to change the bound reference while the application is running, e.g. to display a different user profile, or different product detail page, _Declarative binding_ isn't enough. This can be achieved through the `$rtdbBind`/`$firestoreBind` methods:
79+
If you need to change the bound reference while the application is running, e.g. to display a different user profile, or different product detail page, _Declarative binding_ isn't enough. This can be achieved through the `$databaseBind`/`$firestoreBind` methods:
8080

8181
<FirebaseExample>
8282

@@ -97,7 +97,7 @@ export default {
9797
// call it upon creation too
9898
immediate: true,
9999
handler(id) {
100-
this.$rtdbBind('user', dbRef(users, id))
100+
this.$databaseBind('user', dbRef(users, id))
101101
},
102102
},
103103
},
@@ -133,21 +133,21 @@ export default {
133133
With the approach above, `user` will always be bound to the user defined by the prop `id`
134134

135135
:::tip
136-
No need to call `$rtdbUnbind`/`$firestoreUnbind` as `$rtdbBind`/`$firestoreBind` will automatically unbind any existing binding on the provided key. Upon component removal, all bindings are removed as well, so no need to use `$rtdbUnbind`/`$firestoreUnbind` in `unmounted` hooks.
136+
No need to call `$databaseUnbind`/`$firestoreUnbind` as `$databaseBind`/`$firestoreBind` will automatically unbind any existing binding on the provided key. Upon component removal, all bindings are removed as well, so no need to use `$databaseUnbind`/`$firestoreUnbind` in `unmounted` hooks.
137137
:::
138138

139139
If you need to wait for a binding to be ready before doing something, you can _await_ the returned Promise:
140140

141141
<FirebaseExample>
142142

143143
```js
144-
this.$rtdbBind('user', dbRef(users, this.id).then(user => {
144+
this.$databaseBind('user', dbRef(users, this.id).then(user => {
145145
// user will be an object if this.user was set to anything but an array
146146
// and it will point to the same property declared in data:
147147
// this.user === user
148148
})
149149

150-
this.$rtdbBind('documents', query(documents, orderByChild('creator'), equalTo(this.id))).then(documents => {
150+
this.$databaseBind('documents', query(documents, orderByChild('creator'), equalTo(this.id))).then(documents => {
151151
// documents will be an array if this.documents was initially set to an array
152152
// and it will point to the same property declared in data:
153153
// this.documents === documents
@@ -176,8 +176,8 @@ While VueFire will automatically unbind any reference bound in a component whene
176176
177177
```js
178178
// unsubscribe from Database updates
179-
this.$rtdbUnbind('user')
180-
this.$rtdbUnbind('documents')
179+
this.$databaseUnbind('user')
180+
this.$databaseUnbind('documents')
181181
```
182182
183183
```js
@@ -194,21 +194,21 @@ By default, VueFire **will not reset** the property, you can customize this beha
194194
195195
```js
196196
// default behavior
197-
this.$rtdbUnbind('user')
197+
this.$databaseUnbind('user')
198198
// same as
199-
this.$rtdbUnbind('user', false)
199+
this.$databaseUnbind('user', false)
200200
// this.user === { name: 'Eduardo' }
201201

202202
// using a boolean value for reset to keep current value
203-
this.$rtdbUnbind('user', true)
203+
this.$databaseUnbind('user', true)
204204
// this.user === null
205205

206206
// using the function syntax to customize the value
207-
this.$rtdbUnbind('user', () => ({ name: 'unregistered' }))
207+
this.$databaseUnbind('user', () => ({ name: 'unregistered' }))
208208
// this.user === { name: 'unregistered' }
209209

210210
// for references bound as arrays, they are reset to an empty array by default instead of `null`
211-
this.$rtdbUnbind('documents')
211+
this.$databaseUnbind('documents')
212212
// this.documents === []
213213
```
214214
@@ -239,8 +239,8 @@ It's also possible to customize this behavior when _binding_ by using the `reset
239239
240240
```js
241241
// using a boolean value for reset
242-
await this.$rtdbBind('user', userRef)
243-
this.$rtdbBind('user', otherUserRef, { reset: true })
242+
await this.$databaseBind('user', userRef)
243+
this.$databaseBind('user', otherUserRef, { reset: true })
244244
// while the user is fetched
245245
// this.user === null
246246
```

0 commit comments

Comments
 (0)