I\'m trying to insert a document into a collection. I want the document to have a attribute of type reference to insert into the collection. But every time I in
reference
Probably the simplest solution is to set the value of a reference key to a doc(collection/doc_key) because a DocumentReference is needed.
doc(collection/doc_key)
DocumentReference
Example code:
post = { content: "content...", title: "impressive title", user: db.doc('users/' + user_key), }; db.collection('posts').add(post)