Firestore query using an object element as parameter

后端 未结 4 616

i\'m using Firestore as my database in a project and i have a table that i need to do a query inside an object

{
   foo: "data",
   bar: "data&         


        
相关标签:
4条回答
  • 2020-12-10 15:15

    for some reason to work , u need to leave space between object_name and .property_name

    'exObject .dataToQuery'
    

    instead of

     'exObject.dataToQuery'
    

    leave space and it worked for me

    0 讨论(0)
  • 2020-12-10 15:31

    Here is the answer :

    .where(new firestore.FieldPath('exObject' , 'dataToQuery'), '==', "value"))
    

    More info Here

    0 讨论(0)
  • 2020-12-10 15:32
    dbRef.collection("Table").where("exObject.dataToQuery", "==", "value")
    

    this syntax i first posted is indeed the good syntax and started working eventually. I'd class the reason of my problem as a typo that i must have corrected trying a lot of different things

    0 讨论(0)
  • 2020-12-10 15:33

    Try ( change from 'Table' to 'TEST' )

    xptoCollection : AngularFirestoreCollection<any>;
    
      constructor(private afs: AngularFirestore) { }
    
          this.xptoCollection = this.afs.collection('TEST', ref => {
            return ref.where('exObject.{dataToQuery}', '==', 'value');
          });
    
    0 讨论(0)
提交回复
热议问题