I have a path that I run a Transaction on. I check to see if the value is nil before proceeding. If it is nil I abort and if not I continue. The issue is the value isn't nil but the mutable data is saying it is.
db:
@posts
@postId_abc
-date: ....
-views: 0
Transaction:
let viewsPath = Database.database().reference()
.child("posts")
.child("postId_abc")
.child("views")
viewsPath.runTransactionBlock({ (mutableData: MutableData) -> TransactionResult in
let doesViewsExist = mutableData.value as? Int // I also tried Double
if doesViewsExist == nil {
return TransactionResult.abort() // "views" value is 0
}
// ...
}