I have kotlin data class
data class Client(
val name: String = \"\",
val email: String = \"\",
val phone: String =\"\") {
constructor():this(\"
I just fetch an id from Firestore before and set it as a field on my object before I create it in Firebase:
override fun addTodo(todo: Todo) =
Completable.fromAction {
val id = firestore
.collection(COLLECTION_TODOS)
.document()
.id
val newTodo = todo.copy(id = id)
firestore
.collection(COLLECTION_TODOS)
.document(id)
.set(newTodo)
}