更新记录中的对象数组

Update of array of objects in a record

我在 algolia 有以下记录

enterprise_name:"manaslu enterprise",
objectID:"14417261",_quotation:[{shamagri_title:"paper ad",price:4000,
unit:"per sq inc",
description:"5*5",
geo_latitude:40,
geo_longitude:89,
type:"service"}
]

我想在报价集合更新时将以下对象添加到报价数组。

const enter =  db.collection("quotation").doc("14417261");

  return enter.update({
    shamagri_title: "banner ad",
    rate: 4000,
    unit: "per sq inch",
    description: "15 * 10",
    type: "service",
  });

我尝试使用云函数中的以下代码来更新 algolia 记录

 functions.firestore
  .document("quotation/{quotationId}")

  .onUpdate((change) => {
    const newData = change.after.data();
    const objectID = change.after.id;
    return index.partialUpdateObjects({
      _quotation: {
        _operation: "Add",
        value: newData,
      },
      objectID,
    });
  });

基于 firebase 云函数,它确实提供基于更新的 objectId 我已经根据来自 algolia

的以下示例使用了上面的 partialUpdateObjects 函数
index.partialUpdateObject({
  _tags: {
    _operation: 'AddUnique',
    value: 'public',
  },
  objectID: 'myID',
})
.then(({ objectIDs }) => {
  console.log(objectIDs);
});

然而,在我部署云功能之前,我收到以下错误

 Argument of type '{ _quotation: { _operation: string; value: FirebaseFirestore.DocumentData; }; objectID: string; }' is not assignable to 
parameter of type 'readonly Record<string, any>[]'.
  Object literal may only specify known properties, and '_quotation' does not exist in type 'readonly Record<string, any>[]'.

19       _quotation: {
         ~~~~~~~~~~~~~
20         _operation: "Add",
   ~~~~~~~~~~~~~~~~~~~~~~~~~~
21         value: newData,
   ~~~~~~~~~~~~~~~~~~~~~~~
22       },
   ~~~~~~~

这里可能出了什么问题?

我通过使用摆脱了错误 partialUpdateObject 而不是 partialUpdateObjects 用于更新多个记录。在 algolia 中,对象和对象对单数和复数记录更新产生巨大差异