-2

So i have a collection named products in my Firestore and it contains all my products. Since i am using Tag widget it gives me an error when there is more than one item sharing the same tag. So for my Products Builder i want to give a list that contains all my products without a specific product catched by his id, so stream property of my Stream Builder can be like this.

StreamBuilder(stream: Firestore.instance.collection('products').WITHOUT SPECIFIC PRODUCT ID .snapshot()
builder:...)

How can i do that?

Christopher Moore
  • 15,626
  • 10
  • 42
  • 52
Jo Hassan
  • 35
  • 2
  • 8

1 Answers1

1

It's not possible to construct a query for all documents except one. There are no inequality filters in Firestore.

Since it's just one document, it makes sense to simply do the query for all documents, the have the client code remove the one you don't want from the result set.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • thanks a lot for your answer, it' s still not possible even if i want to do this with category? Like Firestore.instance.collection('products').where(Category, ISNOTEQUALTO : 'Shoes').snapshots(); so i'll get all documents exept ones that have Shoes as their Category name. – Jo Hassan Jul 21 '20 at 21:09
  • last thing, is it possible to shuffle them like with lists? I' ve searched for a method shuffle but it haven't – Jo Hassan Jul 21 '20 at 21:19
  • 1
    As I said in my answer, there are no inequality filters in Firestore. If you have additional questions, please post them separately. – Doug Stevenson Jul 21 '20 at 21:21
  • If Doug answer your question you could follow the recommendations on this document https://stackoverflow.com/help/someone-answers – Harif Velarde Jul 21 '20 at 22:12