Skip to content

Commit b6c8095

Browse files
committed
Docs: Use the term documents instead of elements
As a document-oriented database it's rather strange that we call our entries `elements` instead of `documents`.
1 parent af759c6 commit b6c8095

File tree

13 files changed

+225
-221
lines changed

13 files changed

+225
-221
lines changed

README.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Extensions
138138
| **Status:** *stable*
139139
| **Description:** ``tinydb-smartcache`` provides a smart query cache for
140140
TinyDB. It updates the query cache when
141-
inserting/removing/updating elements so the cache doesn't
141+
inserting/removing/updating documents so the cache doesn't
142142
get invalidated. It's useful if you perform lots of queries
143143
while the data changes only little.
144144
@@ -199,7 +199,7 @@ v3.3.1 (2017-06-27)
199199
v3.3.0 (2017-06-05)
200200
===================
201201

202-
- Allow iterating over a database or table yielding all elements
202+
- Allow iterating over a database or table yielding all documents
203203
(see `pull request #139 <https://github.com/msiemens/tinydb/pull/139>`_).
204204

205205
v3.2.3 (2017-04-22)
@@ -217,7 +217,7 @@ v3.2.2 (2017-01-16)
217217
v3.2.1 (2016-06-29)
218218
===================
219219

220-
- Fix a bug with queries on elements that have a ``path`` key
220+
- Fix a bug with queries on documents that have a ``path`` key
221221
(see `pull request #107 <https://github.com/msiemens/tinydb/pull/107>`_).
222222
- Don't write to the database file needlessly when opening the database
223223
(see `pull request #104 <https://github.com/msiemens/tinydb/pull/104>`_).
@@ -243,7 +243,7 @@ v3.1.3 (2016-02-14)
243243
v3.1.2 (2016-01-30)
244244
===================
245245

246-
- Fix a bug when using unhashable elements (lists, dicts) with
246+
- Fix a bug when using unhashable documents (lists, dicts) with
247247
``Query.any`` or ``Query.all`` queries
248248
(see `a forum post by karibul <https://forum.m-siemens.de/d/4-error-with-any-and-all-queries>`_).
249249

@@ -258,9 +258,9 @@ v3.1.1 (2016-01-23)
258258
v3.1.0 (2015-12-31)
259259
===================
260260

261-
- ``db.update(...)`` and ``db.remove(...)`` now return affected element IDs
261+
- ``db.update(...)`` and ``db.remove(...)`` now return affected document IDs
262262
(see `issue #83 <https://github.com/msiemens/tinydb/issues/83>`_).
263-
- Inserting an invalid element (i.e. not a ``dict``) now raises an error
263+
- Inserting an invalid document (i.e. not a ``dict``) now raises an error
264264
instead of corrupting the database (see
265265
`issue #74 <https://github.com/msiemens/tinydb/issues/74>`_).
266266

docs/api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ API Documentation
2626

2727
.. py:attribute:: eid
2828
29-
The element's id
29+
The document's id
3030

3131
``tinydb.queries``
3232
------------------

docs/changelog.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ v3.3.1 (2017-06-27)
4343
v3.3.0 (2017-06-05)
4444
^^^^^^^^^^^^^^^^^^^
4545

46-
- Allow iterating over a database or table yielding all elements
46+
- Allow iterating over a database or table yielding all documents
4747
(see `pull request #139 <https://github.com/msiemens/tinydb/pull/139>`_).
4848

4949
v3.2.3 (2017-04-22)
@@ -61,7 +61,7 @@ v3.2.2 (2017-01-16)
6161
v3.2.1 (2016-06-29)
6262
^^^^^^^^^^^^^^^^^^^
6363

64-
- Fix a bug with queries on elements that have a ``path`` key
64+
- Fix a bug with queries on documents that have a ``path`` key
6565
(see `pull request #107 <https://github.com/msiemens/tinydb/pull/107>`_).
6666
- Don't write to the database file needlessly when opening the database
6767
(see `pull request #104 <https://github.com/msiemens/tinydb/pull/104>`_).
@@ -81,14 +81,14 @@ v3.2.0 (2016-04-25)
8181
v3.1.3 (2016-02-14)
8282
^^^^^^^^^^^^^^^^^^^
8383

84-
- Fix a bug when using unhashable elements (lists, dicts) with
84+
- Fix a bug when using unhashable documents (lists, dicts) with
8585
``Query.any`` or ``Query.all`` queries
8686
(see `a forum post by karibul <https://forum.m-siemens.de/d/4-error-with-any-and-all-queries>`_).
8787

8888
v3.1.2 (2016-01-30)
8989
^^^^^^^^^^^^^^^^^^^
9090

91-
- Fix a bug when using unhashable elements (lists, dicts) with
91+
- Fix a bug when using unhashable documents (lists, dicts) with
9292
``Query.any`` or ``Query.all`` queries
9393
(see `a forum post by karibul <https://forum.m-siemens.de/d/4-error-with-any-and-all-queries>`_).
9494

@@ -103,9 +103,9 @@ v3.1.1 (2016-01-23)
103103
v3.1.0 (2015-12-31)
104104
^^^^^^^^^^^^^^^^^^^
105105

106-
- ``db.update(...)`` and ``db.remove(...)`` now return affected element IDs
106+
- ``db.update(...)`` and ``db.remove(...)`` now return affected document IDs
107107
(see `issue #83 <https://github.com/msiemens/tinydb/issues/83>`_).
108-
- Inserting an invalid element (i.e. not a ``dict``) now raises an error
108+
- Inserting an invalid document (i.e. not a ``dict``) now raises an error
109109
instead of corrupting the database (see
110110
`issue #74 <https://github.com/msiemens/tinydb/issues/74>`_).
111111

@@ -222,7 +222,7 @@ v2.0.0 (2014-09-05)
222222
(see `issue #18 <https://github.com/msiemens/tinydb/issues/18>`_). Consider
223223
:ref:`tinyrecord` instead.
224224

225-
- Better support for working with :ref:`Element IDs <element_ids>`.
225+
- Better support for working with :ref:`Document IDs <document_ids>`.
226226
- Added support for `nested comparisons <http://tinydb.readthedocs.io/en/v2.0.0/usage.html#nested-queries>`_.
227227
- Added ``all`` and ``any`` `comparisons on lists <http://tinydb.readthedocs.io/en/v2.0.0/usage.html#nested-queries>`_.
228228
- Added optional :<http://tinydb.readthedocs.io/en/v2.0.0/usage.html#smart-query-cache>`_.

docs/extend.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,23 +114,23 @@ Now let's implement that:
114114
for table_name in data:
115115
table = data[table_name]
116116
117-
for element_id in table:
118-
item = table[element_id]
117+
for doc_id in table:
118+
item = table[doc_id]
119119
120120
if item == {}:
121-
del table[element_id]
121+
del table[doc_id]
122122
123123
return data
124124
125125
def write(self, data):
126126
for table_name in data:
127127
table = data[table_name]
128128
129-
for element_id in table:
130-
item = table[element_id]
129+
for doc_id in table:
130+
item = table[doc_id]
131131
132132
if item == {}:
133-
del table[element_id]
133+
del table[doc_id]
134134
135135
self.storage.write(data)
136136

docs/extensions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ Here are some extensions that might be useful to you:
4747
| **Status:** *stable*
4848
| **Description:** ``tinydb-smartcache`` provides a smart query cache for
4949
TinyDB. It updates the query cache when
50-
inserting/removing/updating elements so the cache doesn't
50+
inserting/removing/updating documents so the cache doesn't
5151
get invalidated. It's useful if you perform lots of queries
5252
while the data changes only little.

docs/getting-started.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,23 @@ What about inserting some data? TinyDB expects the data to be Python ``dict``\s:
3131
>>> db.insert({'type': 'apple', 'count': 7})
3232
>>> db.insert({'type': 'peach', 'count': 3})
3333

34-
.. note:: The ``insert`` method returns the inserted element's ID. Read more
35-
about it here: :ref:`element_ids`.
34+
.. note:: The ``insert`` method returns the inserted document's ID. Read more
35+
about it here: :ref:`document_ids`.
3636

3737

38-
Now you can get all elements stored in the database by running:
38+
Now you can get all documents stored in the database by running:
3939

4040
>>> db.all()
4141
[{'count': 7, 'type': 'apple'}, {'count': 3, 'type': 'peach'}]
4242

43-
You can also iter over stored elements:
43+
You can also iter over stored documents:
4444

4545
>>> for item in db:
4646
>>> print(item)
4747
{'count': 7, 'type': 'apple'}
4848
{'count': 3, 'type': 'peach'}
4949

50-
Of course you'll also want to search for specific elements. Let's try:
50+
Of course you'll also want to search for specific documents. Let's try:
5151

5252
>>> Fruit = Query()
5353
>>> db.search(Fruit.type == 'peach')
@@ -63,7 +63,7 @@ Next we'll update the ``count`` field of the apples:
6363
[{'count': 10, 'type': 'apple'}, {'count': 3, 'type': 'peach'}]
6464

6565

66-
In the same manner you can also remove elements:
66+
In the same manner you can also remove documents:
6767

6868
>>> db.remove(Fruit.count < 5)
6969
>>> db.all()
@@ -84,31 +84,31 @@ Before we dive deeper, let's recapitulate the basics:
8484
+-------------------------------+---------------------------------------------------------------+
8585
| **Inserting** |
8686
+-------------------------------+---------------------------------------------------------------+
87-
| ``db.insert(...)`` | Insert an element |
87+
| ``db.insert(...)`` | Insert an document |
8888
+-------------------------------+---------------------------------------------------------------+
8989
| **Getting data** |
9090
+-------------------------------+---------------------------------------------------------------+
91-
| ``db.all()`` | Get all elements |
91+
| ``db.all()`` | Get all documents |
9292
+-------------------------------+---------------------------------------------------------------+
93-
| ``iter(db)`` | Iter over all elements |
93+
| ``iter(db)`` | Iter over all documents |
9494
+-------------------------------+---------------------------------------------------------------+
95-
| ``db.search(query)`` | Get a list of elements matching the query |
95+
| ``db.search(query)`` | Get a list of documents matching the query |
9696
+-------------------------------+---------------------------------------------------------------+
9797
| **Updating** |
9898
+-------------------------------+---------------------------------------------------------------+
99-
| ``db.update(fields, query)`` | Update all elements matching the query to contain ``fields`` |
99+
| ``db.update(fields, query)`` | Update all documents matching the query to contain ``fields`` |
100100
+-------------------------------+---------------------------------------------------------------+
101101
| **Removing** |
102102
+-------------------------------+---------------------------------------------------------------+
103-
| ``db.remove(query)`` | Remove all elements matching the query |
103+
| ``db.remove(query)`` | Remove all documents matching the query |
104104
+-------------------------------+---------------------------------------------------------------+
105-
| ``db.purge()`` | Purge all elements |
105+
| ``db.purge()`` | Purge all documents |
106106
+-------------------------------+---------------------------------------------------------------+
107107
| **Querying** |
108108
+-------------------------------+---------------------------------------------------------------+
109109
| ``Query()`` | Create a new query object |
110110
+-------------------------------+---------------------------------------------------------------+
111-
| ``Query().field == 2`` | Match any element that has a key ``field`` with value |
111+
| ``Query().field == 2`` | Match any document that has a key ``field`` with value |
112112
| | ``== 2`` (also possible: ``!=`` ``>`` ``>=`` ``<`` ``<=``) |
113113
+-------------------------------+---------------------------------------------------------------+
114114

0 commit comments

Comments
 (0)