Skip to content

Commit 7e901f8

Browse files
docs(firestore): update save data guide
1 parent ec710ab commit 7e901f8

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

docs/guide/firestore.rst

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ You can build paths to your data by using the ``collection()`` and ``document()`
2727
2828
..
2929
30+
.. note::
31+
The methods available/used after ``collection()`` method and
32+
``document()`` method are **NOT SAME**. Both method is a
33+
reference to different classes with different methods in them.
34+
35+
3036
Save Data
3137
---------
3238

@@ -53,6 +59,26 @@ the collection named ``Movies``, use ``set()`` method.
5359
document.
5460

5561

62+
63+
To store data in a collection named ``Marvels`` within an auto
64+
generated document ID, use ``add()`` method.
65+
66+
.. code-block:: python
67+
68+
data = {
69+
"name": "Iron Man",
70+
"lead": {
71+
"name": "Robert Downey Jr."
72+
},
73+
'cast': ['Gwyneth Paltrow']
74+
'released': False,
75+
'prequel': None
76+
}
77+
78+
id = fsdb.collection('Marvels').add(data)
79+
..
80+
81+
5682
Read Data
5783
---------
5884

@@ -86,10 +112,6 @@ it contains) of an collection ``Marvels``, use ``get()`` method.
86112
fsdb.collection('Marvels').get()
87113
..
88114
89-
.. note::
90-
The ``get()`` method use after ``collection()`` method and
91-
``document()`` method are **NOT SAME**. They both accept and
92-
return different type of values.
93115

94116
Update Data
95117
-----------

0 commit comments

Comments
 (0)