Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
 
Answered
How to save multiple items of the same type to the database?

I have some data that I want to save of the same type. I see a method called user_data.create however when I use that, the data overwrites the previouse data when using the same short_name. The idea is that the short_name is the same but the values are different. When getting user data, I want to be able to get a list of items of the same type (when calling user_data.get) but I only get one item in the list. Is this even the right db object to use? I don't see other database objects that would support this in the docs.

Posted 4 years ago
Votes Newest

Answers


Hello,

I would recommend you store a JSON string as the value. That way you can store and append multiple values under the same short_name. You can do this via the methods outlined here:
https://www.adamsmith.haus/python/answers/how-to-create-a-json-object-in-python
With more of a description on how those functions work here:
https://docs.python.org/3/library/json.html
You could also store values under multiple short names, but depending on the size and use of the data this is not a good solution, but depending on certain use cases this may be a good solution.

-Trey

Posted 4 years ago
Trey Teter
124 × 2 Administrator