meteor-rest icon indicating copy to clipboard operation
meteor-rest copied to clipboard

PATCH with operators

Open twastvedt opened this issue 9 years ago • 1 comments

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?

twastvedt avatar May 04 '16 21:05 twastvedt

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!

stubailo avatar May 04 '16 22:05 stubailo