Skip to content

Commit 0a3d01f

Browse files
committed
update database
1 parent a688d4d commit 0a3d01f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/database.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Let say we've created a new component for managing users accounts.
3737

3838
It becomes easy for us to add/remove documents to our database, we can add the Person object in Vue data property, and then initialize the Person object with the database reference which might be a real-time reference or Firestore ones, Myfirebase model binds on Person properties.
3939

40+
4041
We can add a new record to our database by:
4142

4243
`push()` - in case of using real-time database.
@@ -45,6 +46,20 @@ We can add a new record to our database by:
4546

4647
Example:
4748

49+
50+
!!! info
51+
1 - You need to import the model into the component.
52+
53+
`import Person from "@/models/Person"`
54+
55+
2 - Then you have to initialize the model with `init()` in the vue's data property.
56+
57+
```
58+
data: () => {
59+
Person: new Person(database_ref).init()
60+
}
61+
```
62+
4863
```html
4964
<template>
5065
<div>

0 commit comments

Comments
 (0)