我正在学习扑克,也是新的火器店,尝试实施并得到这种情况。
我有文件ID的Account
文件是像KCeEhT9NwFURl0xirRrU
和Book
文件的生成器,必须与Account
一起参考,现在我想通过电子邮件创建一个监听Book
的任何更改与特定帐户,我尝试但不工作。
var accountRef = firestore.collection('Account')
.where("email", isEqualTo: email)
.reference()
.document();
firestore.collection('Book')
.where('assigner', isEqualTo: accountRef)
.where('status', isGreaterThan: 0)
.snapshots()
.listen((query) async {
List<Book> books = <Book>[];
for (var documentChange in query.documentChanges) {
var book = await Book.fromMap(documentChange.document.data);
books.add(book);
}
print(books);
}
);
如果我使用它,它可以工作,但我不记得文档ID
var accountRef = firestore.collection('Account').document('KCeEhT9NwFURl0xirRrU');
我只想通过电子邮件过滤,任何帮助,谢谢。
尝试
where("email", "==", email)