File tree Expand file tree Collapse file tree 5 files changed +9
-1
lines changed
firebase-common/src/jsMain/kotlin/dev/gitlive/firebase
androidMain/kotlin/dev/gitlive/firebase/firestore
commonMain/kotlin/dev/gitlive/firebase/firestore
iosMain/kotlin/dev/gitlive/firebase/firestore
jsMain/kotlin/dev/gitlive/firebase/firestore Expand file tree Collapse file tree 5 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -381,7 +381,7 @@ external object firebase {
381381
382382 open class CollectionReference : Query {
383383 val path: String
384- fun doc (path : String ): DocumentReference
384+ fun doc (path : String = definedExternally ): DocumentReference
385385 fun add (data : Any ): Promise <DocumentReference >
386386 }
387387
Original file line number Diff line number Diff line change @@ -364,6 +364,9 @@ actual class CollectionReference(override val android: com.google.firebase.fires
364364 actual val path: String
365365 get() = android.path
366366
367+ actual val document: DocumentReference
368+ get() = DocumentReference (android.document())
369+
367370 actual fun document (documentPath : String ) = DocumentReference (android.document(documentPath))
368371
369372 actual suspend inline fun <reified T > add (data : T , encodeDefaults : Boolean ) =
Original file line number Diff line number Diff line change @@ -128,6 +128,7 @@ expect class DocumentReference {
128128
129129expect class CollectionReference : Query {
130130 val path: String
131+ val document: DocumentReference
131132
132133 fun document (documentPath : String ): DocumentReference
133134 suspend inline fun <reified T > add (data : T , encodeDefaults : Boolean = true): DocumentReference
Original file line number Diff line number Diff line change @@ -279,6 +279,8 @@ actual class CollectionReference(override val ios: FIRCollectionReference) : Que
279279 actual val path: String
280280 get() = ios.path
281281
282+ actual val document get() = DocumentReference (ios.documentWithAutoID())
283+
282284 actual fun document (documentPath : String ) = DocumentReference (ios.documentWithPath(documentPath))
283285
284286 actual suspend inline fun <reified T > add (data : T , encodeDefaults : Boolean ) =
Original file line number Diff line number Diff line change @@ -345,6 +345,8 @@ actual class CollectionReference(override val js: firebase.firestore.CollectionR
345345 actual val path: String
346346 get() = rethrow { js.path }
347347
348+ actual val document get() = rethrow { DocumentReference (js.doc()) }
349+
348350 actual fun document (documentPath : String ) = rethrow { DocumentReference (js.doc(documentPath)) }
349351
350352 actual suspend inline fun <reified T > add (data : T , encodeDefaults : Boolean ) =
You can’t perform that action at this time.
0 commit comments