Rasool ALmusawie
Rasool ALmusawie

Reputation: 61

How can i get single document from Firestore with query (I'm using Ionic 4 )

Good morning , I have database in firestore below :

**collections**       **documents**     **fields** 
123                     news1           title:{some data}
                        news2           content:{some data}

for example i want to get the all data of the (news1) in the page of my ionc4 app , how can i do that please help me

Upvotes: 2

Views: 1535

Answers (1)

Balaj Khan
Balaj Khan

Reputation: 2570

You can achieve this by querying specific document id:

firestore.collection(collectionName).doc(documentId).valueChanges()
.subscribe(singleDoc =>{
console.log(singleDoc)
});

For you the query will look like this:

firestore.collection('123').doc('news1').valueChanges()
.subscribe(news1=>{
console.log(news1)
});

Upvotes: 1

Related Questions