简体   繁体   English

“不支持在链接数组中回填空值”MongoDB / Realm

[英]"backfilling nulls in array of links are not supported" MongoDB / Realm

when I try to add new items to an array inside a document I get this error.当我尝试将新项目添加到文档中的数组时,出现此错误。 As far as I know, the item references do exist in the MongoDB database.据我所知,项目引用确实存在于 MongoDB 数据库中。

The error i get is:我得到的错误是:

[
  "To resolve this issue please update or replace the document in MongoDB to make sure it abides by the schema.",
  "Change Event Type: update",
  "Namespace: app.CompanyLocation",
  "Partition: dag1f7g7102aecdd3e9467711e",
  "Document ID: ObjectID(\"61f7f74a2aecdd3e9467711f\")",
  "Detailed Error: cannot insert link at index 7 of array at path { table: \"CompanyLocation\", fullPath: \"units\" }, array has 6 elements and backfilling nulls in array of links are not supported",
  "Number of Unsyncable Documents: 1"
]

The code causing the error is:导致错误的代码是:

 const newUnits = result.Shipment.Units[0].Unit.map(u => u._attributes.UID +  u._attributes.PSN).flat();
  console.log(newUnits);
  if(importResult.success){
  // Lägg till den som inventory på platsen.
  context.services.get("mongodb-atlas")
  .db("app")
  .collection("CompanyLocation")
  .updateOne(
    {
      _id: new BSON.ObjectId(place), 
      _partition: partition}, 
      {
        $push: {
          units: {
            $each: newUnits
          }
          
        }
        
      }
    )
  console.log(newUnits);
}

My question is: What may be causing this & What does the error message mean?我的问题是:可能是什么原因造成的?错误消息是什么意思?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM