angularfire2 - how can use multiple where clauses in firebase?

Viewed 1808
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

1 Answers

You can pass in list format

Try this

query: {
    orderBy: ["key1","key2"],
    equalTo: 'val1'
}
Related