I've a collection called users consisting their name and other personal details, and it also have a sub collection consisting of their vehicles.
But for some operation, I want to query only the user data. I'm afraid that it would include the sub collection also, which will increase my data usage.
The database structure is shown below:
db.collection("users").limit(10)
.get()
.then(function(querySnapshot) {
querySnapshot.forEach(function(doc) {
console.log(doc.data());
$scope.userList.push(doc.data());
});
})
.catch(function(error) {
console.log("Error getting documents: ", error);
});
I'm getting the data but i'm not sure whether this is the correct way of querying or not.