Add limit option to db.all() and db.search() to limit the query result.
this will also limit cached query result
example
from tinydb import TinyDB, where
db = TinyDB("local.json")
# insert some data
for i in enumerate(range(0, 20)):
db.insert({
"id": i,
"name": "awesome name"
})
db.all() # 20
db.all(limit=9) # 9
ldb.search(where("id") > 1 and where("id") > 10) # 9
db.search(where("id") > 1 and where("id") > 10, limit=3) # 3
🖐😃
509
changes
Add
limit
option todb.all()
anddb.search()
to limit the query result. this will also limit cached query resultexample