6

this.afs
      .collection('userroutes' + cityid, ref =>
        ref.where(
          'requestList',
          'array-contains',
          'str'
        )
      )
      .valueChanges()
      .subscribe(data => {
        //I get the data
        //this works
      });`

not working

this.afs
  .collection('userroutes' + cityid, ref =>
    ref.where(
      'requestList.id',  <-- in case of object search what it will
      'array-contains',
      'ED8r2DWAcyM0sKJiAJxwwAVDm2q2'
    )
  )
  .valueChanges()
  .subscribe(data => {
    //this do not give any data....
    //though this id is present id firebase db
  });

Not working

this.afs
  .collection('userroutes' + cityid, ref =>
    ref.where(
      'requestList',  <-- in case of object search what it will
      'array-contains',
      'ED8r2DWAcyM0sKJiAJxwwAVDm2q2'
    )
  )
  .valueChanges()
  .subscribe(data => {
    //this do not give any data....
    //though this id is present id firebase db
  });

I am trying to use the new feature from firebase 5.3.0 which is array-contains; what I see that it only works for string but not for object;

This works fine in case of string.

CJ Dennis
  • 4,226
  • 2
  • 40
  • 69

0 Answers0