小编use*_*857的帖子

从云端功能删除Firestore文档中的字段

如何从Cloud Firestore函数中删除文档中的字段?

我正在使用事务,所以我尝试了这种方法:

    const { FieldValue } = require('@google-cloud/firestore');
    ...   
    ..
    transaction.update(docRef, { fieldToRemove: FieldValue.delete() });
Run Code Online (Sandbox Code Playgroud)

但我收到此错误:

Transaction failure: Error: Update() requires either a single JavaScript object or an alternating list of field/value pairs that can be followed by an optional precondition. Argument "dataOrField" is not a valid Document. Couldn't serialize object of type "DeleteTransform". Firestore doesn't support JavaScript objects with custom prototypes (i.e. objects that were created via the 'new' operator).
Run Code Online (Sandbox Code Playgroud)

谢谢 !

firebase google-cloud-functions google-cloud-firestore

6
推荐指数
1
解决办法
789
查看次数

Firestore REST API:将对象推送到数组值字段

我正在尝试使用 REST API 更新 firestore 数据库中的字段,但我找不到在不覆盖字段初始数据的情况下执行此操作的方法。

这是我的数据库文档示例中的消息字段:

Messages : [
{ senderId: "id-1", text: "Hi Jack"}
{ senderId: "id-2", text: "Hello"}
]
Run Code Online (Sandbox Code Playgroud)

如何在不删除以前的数据的情况下将新对象(mapValue)添加/推送到{ senderId: "id-1", text: "How are you"}我的消息字段?

我尝试使用 updateMask.fieldPaths=Messages 修补 REST API,但它会覆盖以前的数据。

谢谢

firebase firebase-realtime-database google-cloud-firestore

5
推荐指数
0
解决办法
740
查看次数

Travis Ci构建因Java Maven项目而失败

我将Travic CI用作在java maven项目上进行仔细整合的工具,并且我的.travis.yml文件是通过以下方式配置的:

language: java
sudo: false
script: mvn clean verify
Run Code Online (Sandbox Code Playgroud)

但是当我执行时,出现此错误:

The travis ci build could not complete due to an error
The command "eval mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V" failed.
Run Code Online (Sandbox Code Playgroud)

任何人都有解决此问题的想法?谢谢

java maven travis-ci

0
推荐指数
1
解决办法
1116
查看次数