I have a problem with my chat in firebase, I'm trying to find what chats my user is in, for doing that, I want to run a query that finds these id inside an array calls Conversadores inside my document which is inside my collection called mensajes.
Mensajes (collection) >> document >> conversadores (array of strings)
Is it possible to do this? I'm ran out of ideas,
@Injectable()
export class ChatProvider {
private itemDoc: AngularFirestoreCollection<Mensajes>;
item: Observable<Mensajes[]>;
constructor(private afs: AngularFirestore, private _lp: LoginProvider) {
this.itemDoc = afs.collection('mensajes', ref =>
ref.where('conversadores', '==', _lp.userId) //userId is a string (ex.'ford0013')
.orderBy('fechaCreacion', 'desc'));
this.item = this.itemDoc.valueChanges();
}
}