-
Hi! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Or does it load everything in memory so this doesnt make sense? |
Beta Was this translation helpful? Give feedback.
-
Assuming that you're using the default db.all()[-10:] # will return a list of the ten most recently inserted documents |
Beta Was this translation helpful? Give feedback.
-
Query results would work the same way:
will display a list of the three most recently inserted documents among the query results. |
Beta Was this translation helpful? Give feedback.
Assuming that you're using the default
JSONStorage
and that you haven't setsort_keys=True,
then (sincedb.all()
returns a list of dicts), you can slice the results:db.all()[-10:] # will return a list of the ten most recently inserted documents
db.all()[-3:] # will return a list of the three most recently inserted documents