FrangSierra / RxFirebase

Rxjava 2.0 wrapper on Google's Android Firebase library.
MIT License
514 stars 71 forks source link

Default SetOptions should be OVERWRITE #81

Open johannesnormannjensen opened 5 years ago

johannesnormannjensen commented 5 years ago

When setting a POJO the default SetOptions should be OVERWRITE so that Firestore conventions are followed

rojepp commented 1 year ago

There seems to be no way of creating a SetOptions with merge = false? So this library would need to call another overload instead of passing SetOptions.merge()? But this library is dead, right?

The bug should be here: https://github.com/FrangSierra/RxFirebase/blob/master/app/src/main/java/durdinapps/rxfirebase2/RxFirestore.java#L449

If anyone is stuck on this, I solved the problem locally by just doing what RxFirestore.set does internally:

    fun saveDeviceStatusOnline(d: FSDevice): Completable {
        val col = collection("client_info")
        val document = col.document(d.getDocumentPath())

        //return RxFirestore.setDocument(document, d).subscribeOn(Schedulers.io())
        return Completable.create { emitter ->
            RxCompletableHandler.assignOnTask<Void>(
                emitter,
                document.set(d)
            )
        }.subscribeOn(Schedulers.io())
    }