Google cloud datastore 使用数据存储命令行工具创建嵌入式实体
我正在尝试使用GoogleCloudDatastore命令行界面创建嵌入式实体数组。我已经了解了如何创建嵌入式实体值,如下所示:Google cloud datastore 使用数据存储命令行工具创建嵌入式实体,google-cloud-datastore,Google Cloud Datastore,我正在尝试使用GoogleCloudDatastore命令行界面创建嵌入式实体数组。我已经了解了如何创建嵌入式实体值,如下所示: { "properties": { "age": { "integerValue": "5" }, "height": { "integerValue": "6" } } } { "values": [ {
{
"properties": {
"age": {
"integerValue": "5"
},
"height": {
"integerValue": "6"
}
}
}
{
"values": [
{
"stringValue": "one"
},
{
"stringValue": "two"
}
]
}
以及如何创建数组值,如下所示:
{
"properties": {
"age": {
"integerValue": "5"
},
"height": {
"integerValue": "6"
}
}
}
{
"values": [
{
"stringValue": "one"
},
{
"stringValue": "two"
}
]
}
但我还没有弄明白如何向数组中添加嵌入值。例如:
{
"values": [
{
"stringValue": "one"
},
{
"stringValue": "two"
},
{
"embeddedEntityValue": {
"properties": {
"age": {
"integerValue": "5"
},
"height": {
"integerValue": "6"
}
}
}
}
]
}
给出了错误:
“此数组中的一个或多个值看起来不正确。如果包含值,请确保它们是JSON格式的数据存储数组值。”我认为
embeddedEntityValue
应更改为entityValue
。下面的示例显示了一个包含两个嵌入实体的数组字段:
{
"values": [
{
"entityValue": {
"properties": {
"areaCode": {
"stringValue": "40"
},
"countryCode": {
"stringValue": "91"
},
"subscriberNumber": {
"stringValue": "2722 5858"
}
}
}
},
{
"entityValue": {
"properties": {
"countryCode": {
"stringValue": "91"
},
"subscriberNumber": {
"stringValue": "6666 0000"
},
"areaCode": {
"stringValue": "80"
}
}
}
}
]
}