3
this.db.list('key_threads/key_threadList', {  
            query: {
                orderBy: "key1",
                equalTo: 'val1', 
                orderBy: "key2",  // I GET ERROR HEARE
                equalTo: 'val2', 
            }
        }).subscribe(
            result => { 
                console.log('result ' + JSON.stringify(result));
           });

When I use above code snippet I got error form intellisense:

[ts] An object literal cannot have multiple properties with the same name in strict mode.

[ts] Duplicate identifier 'orderBy'.

reason to use multiple time orderBy is :

I wont to make query for multiple child in where clouse like

select * from user where key1='val1' and key2='val2'

Is it no way to implement above SQL query in firebase ?

I use :

angularfire2 : 4.0.0-rc.0

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Rahul Tank
  • 770
  • 1
  • 8
  • 20

1 Answers1

1

You can pass in list format

Try this

query: {
    orderBy: ["key1","key2"],
    equalTo: 'val1'
}
Saurabh Agrawal
  • 7,581
  • 2
  • 27
  • 51
  • [Firebase Database queries can only order/filter on a single property](https://stackoverflow.com/q/42260757/5621827) – jitender Nov 06 '17 at 05:02