Firestore:文档父名称缺少"/" [英] Firestore: Document parent name lacks "/"

查看:54
本文介绍了Firestore:文档父名称缺少"/"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开玩笑地对Firestore执行集成测试.我希望收到包含等于field1和field2的字段的文档.但是,我收到了以下错误.

I am using jest to perform integration tests to firestore. I expected to receive document consisting of fields equal to field1 and field2. However, I have received the below error instead.

我尝试在Firecase控制台中创建一个复合索引,但是问题仍然存在.这种情况似乎仅在测试期间发生,因为当我正常运行Node.js应用程序时,代码可以正常工作.我已将错误范围缩小至以下代码:

I have tried creating a composite index in firecase console but the problem still persists. This situation seems to only happen during testing as the code works fine when I run the Node.js app normally. I have narrowed the error to come from the code below:

const response = await fs.collection('collection1').where('field1', '==', field1).where('field2', '==', field2).get();

错误消息如下:

Error: FirebaseError: [code=invalid-argument]: Document parent name "projects/int-test-1-5tb01cf1-poiu-0qa8-lk87-e1aeff685f2d/databases/(default)" lacks "/" at index 76.

推荐答案

将软件包@ firebase/test升级到版本0.11.8(与firebase-admin 8.3.0匹配)并运行仿真器的7.2.0版本.为我解决了这个问题.

Upgrading the package @firebase/testing to version 0.11.8 (matching up with firebase-admin 8.3.0) and running the 7.2.0 version of the emulator fixed this issue for me.

这篇关于Firestore:文档父名称缺少"/"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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