0

I have a Firestore collection named "operation" where each document may or may not have a field named "user" of type reference. I want to retrieve only the documents that do not have the "user" field. I'm using AngularFire in my Angular application. Is there a way to achieve this using AngularFire's query functions? Here's an example of what I'm trying to achieve:

getOperations(){
    let operations = this.fstore
                    .collection<Operation>('operation', 
                      x => x.where('user','==', /*WHAT TO PUT HERE*/)
                      .orderBy('created_at', 'desc')
                    )
                    .snapshotChanges();
    return operations;
}
byteram
  • 125
  • 8
  • 2
    Firestore can't query at all for fields that don't exist. You need to have a value there in order to be indexed for a query, even if the value is just null. – Doug Stevenson Jul 14 '23 at 23:58

0 Answers0