This repository was archived by the owner on Jun 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Batch write - not workingΒ #3
Copy link
Copy link
Open
Description
I am getting StackOverflow exception when trying to commit a batch.
My code is as follows :-
override suspend fun insertAll(list: List<PostSiteResponse>) {
val userId = prefs.getCurrentUserId() ?: return
val siteRef = firestore.collection(FirebaseConstants.TABLE_USERS)
.document(userId.toString())
.collection(FirebaseConstants.TABLE_SITES)
val batch = firestore.batch()
list.forEach {
val obj = it.toSite()
val map = Mapper.mapNullable(obj)
batch.set(siteRef.document(it.locationId.toString()), map , SetOptions.Merge)
}
batch.commit_()
}
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.guardso_new, PID: 28090
java.lang.StackOverflowError: stack size 8MB
at co.touchlab.firebase.firestore.WriteBatchKt.set(Unknown Source:2)
at co.touchlab.firebase.firestore.WriteBatchKt.set(WriteBatch.kt:14)
TheHemantKaushik
Metadata
Metadata
Assignees
Labels
No labels