Skip to content

Commit 5993a41

Browse files
committed
docs: add note about field comparison
See #574
1 parent 22760b9 commit 5993a41

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

docs/getting-started.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,12 @@ Before we dive deeper, let's recapitulate the basics:
112112
| | ``== 2`` (also possible: ``!=``, ``>``, ``>=``, ``<``, ``<=``)|
113113
+-------------------------------+---------------------------------------------------------------+
114114

115+
.. note::
116+
117+
Query comparisons only support literal values on the right-hand side.
118+
Field-to-field comparisons like ``Query().a == Query().b`` are not
119+
supported. Use a callable predicate like
120+
``db.search(lambda doc: doc.get('a') == doc.get('b'))`` for custom logic.
121+
115122
.. References
116123
.. _GitHub: http://github.com/msiemens/tinydb/

docs/usage.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@ queries:
203203

204204
You can compose queries dynamically by using the no-op query ``Query().noop()``.
205205

206+
Comparisons only support literal values on the right-hand side. Field-to-field
207+
comparisons like ``Query().a == Query().b`` are not supported. Use a callable
208+
predicate like ``db.search(lambda doc: doc.get('a') == doc.get('b'))`` for
209+
custom logic.
210+
206211
Recap
207212
.....
208213

0 commit comments

Comments
 (0)