Skip to content
This repository has been archived by the owner on Jan 3, 2021. It is now read-only.

Commit

Permalink
Correctly handle nil with update
Browse files Browse the repository at this point in the history
  • Loading branch information
Obbut committed Oct 3, 2018
1 parent 3d39ece commit b928ae3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Sources/Meow/Context.swift
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,15 @@ public final class Context {

var set = [String: Primitive?]()

var unsetKeys = Set(fields)

for key in document.keys where fields.contains(key) {
set[key] = document[key]
unsetKeys.remove(key)
}

for key in unsetKeys {
set[key] = .some(nil)
}

return self.manager.collection(for: M.self)
Expand Down

0 comments on commit b928ae3

Please sign in to comment.