Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inserting into subcollections #82

Open
rezamohamed opened this issue Jun 15, 2021 · 1 comment
Open

Inserting into subcollections #82

rezamohamed opened this issue Jun 15, 2021 · 1 comment

Comments

@rezamohamed
Copy link

I have a collection where the root is the UserID, and then I have a Sub-Collection of 'businesscards'. I am trying to insert new docs to this subcollection.

This code creates new documents on each insert with new DocId's at the UserID level with the Collection Name just called 'businesscards' for each new DocId that got create. How would I insert the new docs into the collection called 'businesscards'? I don't have the Document ID for the 'businesscards' subcollection.

                var x = 
                    await CrossCloudFirestore.Current.Instance
                    .Collection(userId)
                    .Document()
                    .Collection('businesscards')
                    .AddAsync(doc);
@rezamohamed
Copy link
Author

Not sure if this is the right approach, but I gave the Document the same name as the Collection

var x =
await CrossCloudFirestore.Current.Instance
.Collection(userId)
.Document('businesscards')
.Collection('businesscards')
.AddAsync(doc);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant