Closed kimdv closed 7 years ago
Shouldn't be difficult to implement. MongoDB has the $set
operator which perfectly aligns with this.
I already implemented this last week. I'll update the docs soon, but in short: Meow generates a Values
struct that represents partial values of a model. Currently you can myModel.update(with: partialValues.serialize())
but this will be more seamless in the future.
You can see how I handle PATCH requests in MeowVapor here: https://github.com/OpenKitten/MeowVapor/blob/master/Sources/MeowVapor/ModelController.swift#L64
A partial update for a document so that can be used with the PATCH request. It is also more bandwidth friendly if MongoDB is hosted externally.