Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DocumentId annotation? #441

Unanswered
mr-kew asked this question in Q&A
Discussion options

Is there an equivalent to @DocumentId annotation?

I am using @Serializable data class and I want it to include its own documentId so I can reference it later from other documents. Something like this:

@Serializable
data class One(
 @DocumentId
 val id: String,
)
@Serializable 
data class Two(
 @DocumentId
 val id: String,
 val oneId: String,
)
...
val one: One = Firebase.firestore
 .collection("ones")
 .get()
 .documents
 .first()
 .data<One>()
Firebase.firestore
 .collection("twos")
 .where("oneId", equals = one.id)
 ...

How can I achieve it with this library?

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /