[英]Firestore filtering by document reference
我正在尝试按 React Native 中的文档引用进行过滤。 我正在使用react-native-firebase
。 我想要其字段(DocumentReference)在提供的数组中的所有文档:
const subscriber = firestore()
.collection('strategyCounts')
.where(
'strategy',
'in',
user.strategies.map(strategy => {
return strategy.path;
}),
).onSnapshot(...)
user.strategies
看起来像这样["/strategies/id", "/strategy/id2"]
如果要按文档引用进行过滤,则需要在数组中传递DocumentReference
对象。 所以像:
user.strategies.map(strategy => {
return firestore().doc(strategy.path);
}),
或(略短):
user.strategies.map(strategy => firestore().doc(strategy.path)),
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.