@@ -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