meteor-rest
meteor-rest copied to clipboard
PATCH with operators
I'd like to be able to use MongoDB's operators, for example $push or $addToSet to update a collection. The docs say:
Updating a document in a collection: The body of the request should be a JSON-serialized set of fields to update in the document.
So if I try to use an operator, Mongo says:
Error: MongoError: The dollar ($) prefixed field '$push' in '$push' is not valid for storage.
Is it possible to just treat the body of a PATCH request as a MongoDB update parameter rather than a set of fields which, as I understand it, is a subset of a query?
Hmm, I guess it would be fine as long as allow/deny rules are still respected (they are in the current implementation).
I'd look at a PR for this!