颤振-Firebase-按列表项值查询
我有一个可用性列表,并希望根据键31的值进行查询,该值大于0。我还没有找到正确的语法来实现它。我要走了颤振-Firebase-按列表项值查询,firebase,flutter,google-cloud-firestore,Firebase,Flutter,Google Cloud Firestore,我有一个可用性列表,并希望根据键31的值进行查询,该值大于0。我还没有找到正确的语法来实现它。我要走了 flutter: Paths must not contain '~', '*', '/', '[', or ']'. 有没有办法让它工作起来?还是我需要重新思考这个问题 final Query nextSlot = FirebaseFirestore.instance .collection('locations') .where('availability
flutter: Paths must not contain '~', '*', '/', '[', or ']'.
有没有办法让它工作起来?还是我需要重新思考这个问题
final Query nextSlot = FirebaseFirestore.instance
.collection('locations')
.where('availability{31}', isGreaterThan: 0);
..does not give error but gives 0 results..
.where('availability[31]', isGreaterThan: 0);
.where('availability/31', isGreaterThan: 0);
.. returns the format error.
新年快乐,谢谢
我确信firebase和Dart使用点符号,所以您需要:
final Query nextSlot = FirebaseFirestore.instance
.collection('locations')
.where('availability.31', isGreaterThan: 0);
实际上,这里没有列表类型的字段-您有一个映射,其键是字符串形式的数字(所有映射键始终被视为字符串,即使它们看起来像数字)。可以使用点表示法根据地图字段的值筛选查询。尝试了除点以外的所有方法。谢谢!