Hello i wanna do some select by firebase

i want to do one request same: this.afdb.database.list(’/chat/’, {
query: {
orderByChild: ‘date’,where(idUser===“param”)

constructor(public afs: AngularFirestore) {}

getUserChat(id) {
   return this.afs.collection('chat', ref => ref.where('idUser', '==', id).orderBy('date')).valueChanges();

thanks lacOniC but i use real time database can i use AngularFirestore for get data? and is it possible to use 2 conditions like ref.where(‘idUser’, ‘==’, id1 and ‘idUser’, ‘==’, id2)

Firestore is the newest database. If it is possible (new project) use Firestore.

There is no AND but you can use multiple conditions like:

ref.where('idUser', '==', id).where('userName', '==', name)


Yeah thank LacOnic you are the best

1 Like

hi LacOnic i wanna do some thing like ref.where(‘idUser’, ‘==’, id OR ‘idUser’, ‘==’, id2 ) . how can i do that?

There is no OR operator. To me it’s the biggest missing in Firestore. But in your situation there is no need to OR. You can use IN operator:

ref.where('idUser', 'in', ['123', '456']);


1 Like

Thanks i did it successfuly