不支持嵌套数组 [英] Nested arrays are not supported

查看:83
本文介绍了不支持嵌套数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新的Firebase数据库Firestore说

The new Firebase database Firestore says

使用无效数据调用的函数DocumentReference.set().不支持嵌套数组.

Function DocumentReference.set() called with invalid data. Nested arrays are not supported.

尝试保存以下对象时:

{
  "desc" : "Blala",
  "geojson" : {
    "features" : [ {
      "geometry" : {
        "coordinates" : [ 8.177433013916017, 48.27753810094064 ],
        "type" : "Point"
      },
      "type" : "Feature"
    } ],
    "type" : "FeatureCollection"
  },
  "location" : {
    "lat" : 48.27753810094064,
    "lng" : 8.177433013916017
  },
  "name" : "Wald und Wiesen",
  "owner" : "8a2QQeTG2zRawZJA3tr1oyOAOSF3",
  "prices" : {
    "game" : {
      "Damwild" : 10,
      "Raubwild" : 300,
      "Rehwild" : 250,
      "Schwarzwild" : 40
    },
    "perDay" : 35
  },
  "rules" : "Keine Regeln!",
  "wild" : {
    "desc" : "kein Wild",
    "tags" : [ "Damwild", "Rehwild", "Schwarzwild", "Raubwild" ]
  }
}

firestore抱怨的嵌套数组到底是什么?我在文档中找不到它.

what exactly is the nested array that firestore is complaining about? I can't find it in the documentation.

如果它是GeoJSON对象-我将如何保存它?

If it's the GeoJSON object - how would I save it instead?

推荐答案

更新:在Firebase JS SDK 4.6.0中已修复此问题.仍然不支持直接嵌套数组,但是您现在可以拥有一个包含对象的数组,该对象包含一个数组,等等.

UPDATE: This was fixed in Firebase JS SDK 4.6.0. Directly nested arrays are still unsupported, but you can now have an array that contains an object that contains an array, etc.

这是当前发布的SDK中的错误.

This is a bug in the currently released SDKs.

后端有一个限制,即不支持仅直接嵌套的数组.

The backend has the restriction that only directly nested Arrays are unsupported.

在您的情况下,您有包含包含对象的数组的对象,这些对象包含数组,并且客户端中的验证逻辑不允许这样做.

In your case you have arrays containing objects containing arrays and the validation logic in the clients is disallowing it when it shouldn't.

没有跟踪此问题的公共错误,但是一旦有修复程序,我会回发.

There's no public bug tracking this but I'll post back when we have a fix.

这篇关于不支持嵌套数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆