Answers for "firebase track database request firestore"

11

how to query in firestore

db.collection("cities").where("capital", "==", true)
    .get()
    .then(function(querySnapshot) {
        querySnapshot.forEach(function(doc) {
            // doc.data() is never undefined for query doc snapshots
            console.log(doc.id, " => ", doc.data());
        });
    })
    .catch(function(error) {
        console.log("Error getting documents: ", error);
    });
Posted by: Guest on May-28-2020
1

firestoreConnect query

firestoreConnect((props) => {
		let propertyDocRef = firebase.firestore().collection('properties').doc(props.propertyId)
		if (!props.propertyId) return []
		return [
			{
				collection : 'properties',
                doc            : props.propertyId,
				subcollections : [
					{ collection: 'tasks' }
				],
				storeAs        : 'tasks',
				orderBy        : [
					'createdAt',
					'desc'
				]
			},
			{
				collection : 'likes',
				where      : [
					[
						'property',
						'==',
						propertyDocRef
					]
				]
			}
		]
	})
Posted by: Guest on February-11-2020

Code answers related to "firebase track database request firestore"

Browse Popular Code Answers by Language