Remove Data
Delete key/value pairs
Delete a entry (a value) assigned to a key named "nickname"
Delete an entry (a value) under a key nickname but only if it contains a substring "foobar":
Delete several keys at once:
Delete values from a list
Lists are collections of values. Lists typically do not have keys. To remove an item from a list, we do it by-value.
Remove a value from a list named "mylist".
Remove all values from a list named "mylist" that begin with 2025.
Reset a list. Removes all items from a list, effectively deleting that list. This would delete all entries from a list named "mylist"
Delete files
A file uploaded with .putObject() stays stored until it's deleted. Use the same project/domain/subdomain/list as the upload.
Time-To-Live (TTL)
Values are kept until you delete them, unless they're given a time-to-live (TTL): a number of days after which they're deleted automatically.
Set it for a value when you write it, with .ttl(days) (&ttl=[days]), or for every value already stored in a scope with .expire(days), e.g. db.project("my-app").expire(30).
Deleting data
To erase data right away, use .delete() (see above) rather than a TTL. A TTL of 0 (or less) doesn't delete anything: it means the value never expires.
You can pass a Time-To-Live directive with each .write() call, which will cause saved values to be purged - as in permanently deleted - after N number of days. The countdown starts when the value is written, and reading the value doesn't reset it. Writing the value again with a TTL restarts it; writing it again without one keeps the TTL it had.
ttl=<number-of-days>
Example: the 'theme' setting for user janedoe will be erased after 15 days. Any other values associated with that key will not be affected - unless they also were set with an explicit ttl value.
IMPORTANT: TTL parameter is enforced at a value level, meaning it only affects key/value pair, an object , or any piece of data it was assigned to and does not apply to other values associated with your key. To set a TTL on many existing values at once, use .expire(days) on a scope: db.project("my-app").expire(30) covers everything under project my-app, and db.project("my-app").domain("active-users").expire(1) only what's under both.
curl -s -b cookies.txt -H "X-Authorization: Token $KEY" \
-G https://prefsdb.com/api/v1/expire/ -d project=my-app -d days=30
# {"success":true,"status":"success","ttl":30,"updated":{"pairs":4,"lists":1},...}
curl -s -b cookies.txt -H "X-Authorization: Token $KEY" \
-G https://prefsdb.com/api/v1/expire/ -d project=my-app -d domain=active-users -d days=1