Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google cloud datastore 使用数据存储命令行工具创建嵌入式实体_Google Cloud Datastore - Fatal编程技术网

Google cloud datastore 使用数据存储命令行工具创建嵌入式实体

Google cloud datastore 使用数据存储命令行工具创建嵌入式实体,google-cloud-datastore,Google Cloud Datastore,我正在尝试使用GoogleCloudDatastore命令行界面创建嵌入式实体数组。我已经了解了如何创建嵌入式实体值,如下所示: { "properties": { "age": { "integerValue": "5" }, "height": { "integerValue": "6" } } } { "values": [ {

我正在尝试使用GoogleCloudDatastore命令行界面创建嵌入式实体数组。我已经了解了如何创建嵌入式实体值,如下所示:

{
    "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"
          }
        }
      }
    }
  ]
}