Firestore nested collections
See original GitHub issuehello eddy,
first of all thx for this amazing plugin!
I am trying to use the new firestore feature. The firebase docs are saying that yon can nest a collection under a document ref. Using your plugin the nesting doesn´t work. The collection is always being created under the root of the database.
Here my example code
let userDoc = firestore.collection('users').doc(user.uid);
userDoc.set({email: user.email});
userDoc.collection('worktimes').doc(data.key).set({
date: data.value.date,
reverseOrderDate: data.value.reverseOrderDate,
workTimeEnd: data.value.workTimeEnd,
workTimeStart: data.value.workTimeStart,
workingMinutesBrutto: data.value.workingMinutesBrutto,
workingMinutesNetto: data.value.workingMinutesNetto,
workingMinutesOverTime: data.value.workingMinutesOverTime,
workingMinutesPause: data.value.workingMinutesPause
});
I´m expecting the worktimes data under the user document but in the firebase console there is a collection “worktimes” at the root level.
The data comes from an api call. Any ideas? Thx Armin
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Get Firestore documents in nested collections | Google Cloud
Get Firestore documents in nested collections. bookmark_border. Stay organized with collections Save and categorize content based on your preferences.
Read more >Cloud Firestore Data model - Firebase
Documents can contain subcollections and nested objects, both of which can include primitive fields like strings or complex objects like lists. Collections and ......
Read more >How to use Nested Collections in cloud firestore - YouTube
In this video, you'll learn:- 1. Why use NestedCollections instead of arrays? 2. How to create a collection inside a document?
Read more >Firestore: Query multiple nested collections - Stack Overflow
To read from all events-collection collections in one go, you can use a collection group query. For example, without any conditions, ...
Read more >Creating and querying nested collections in Firebase
const currentUser = firebase.auth().currentUser.uid; const eventsRef = firebase.firestore().collection('events'); · const documentId = document.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
no one?
I think I found the problem, in firebase.android.ts you are creating a collection from the root db instance everytime. If I don´t chain the collection.doc.collection calls instead get the collection with a deeplink (users/${user.uid}/worktimes) it works.
We need to find a way to determan if the collection is a chained one or the root one. If chained generate the path relative to the document otherwise generate the path from the root db.