猿问

地图字段上的 Firestore 集合查询

我有一个如下所示的 firestore 集合,我想查询 Map 字段以过滤结果。这是我的代码,但我总是看不到任何结果。有人可以帮忙吗?谢谢你!


const myRef = firebase.firestore().collection('otherCollection').doc('123456');

const res = await firebase

  .firestore()

  .collection('myCollection')

  .where('testMap.array1', 'in ',  myRef)

  .get();

子衿沉夜
浏览 75回答 1
1回答

DIEA

您所描述的是array-containsFirestore 中的操作。它被实现为:firebase   .firestore()   .collection('myCollection')   .where('testMap.array1', 'array-contains',  myRef)   .get();我自己从来没有array-contains使用文档引用运行过,所以请告诉我它是否有效。
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答