Saving JSON as a value inside embedded entities in Cloud Datastore

荒凉一梦 提交于 2019-12-11 14:29:55

问题


In Google Cloud Store entities - is there a way to store JSON as the VALUE of an embedded entity property?

For example, I would expect something like this:

{
    "properties": {
        "someObject": {
            "objectValue": {"some":"sutome","json":"object"}
        }
    }
}

objectValue would be the type of the property

Thanks


回答1:


In Google Cloud Store entities - is there a way to store JSON as the VALUE of an embedded entity property?

Not directly. However, what you can do is stringify the JSON object and store it as a StringValue (just remember to parse the value back into a JSON object once you retrieve it). Note that if the property that stores the string value is indexed the maximum size the string can be is 1500 bytes, if the property is not indexed the max size of the string is 1MB(1,000,000 bytes).



来源:https://stackoverflow.com/questions/45059355/saving-json-as-a-value-inside-embedded-entities-in-cloud-datastore

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!