mongorito icon indicating copy to clipboard operation
mongorito copied to clipboard

$push

Open devdebonair opened this issue 9 years ago • 8 comments

Saw a discussion about this in Issue #51. Have we reached a conclusion about adding this function to the api? I would love this feature implemented.

let comment = { ... };

Post.push(id, "comments", comment);

This pattern would seem appropriate to me. I see that the library is going for simplicity, which is the main reason I picked it up. It just seems a shame to ignore these functions.

devdebonair avatar Feb 03 '16 22:02 devdebonair

No, still no conclusion on this one. I have to delay this feature for future releases, in order to ship 2.0 faster.

vadimdemedes avatar Feb 21 '16 16:02 vadimdemedes

while we wait for this enhancement, what's the current best practice to perform this action?

paul42 avatar Apr 27 '16 18:04 paul42

Unfortunately, none at the moment.

vadimdemedes avatar May 11 '16 12:05 vadimdemedes

@vdemedes makes a good point on what should be embedded and what should not, generally the example on #51 is not a good one however, this does need to be solved conceptually as other mongo methods for $inc, $mul, $rename etc.. (essentially all update operators https://docs.mongodb.com/v2.6/reference/operator/update-field/) would be left out of an elegant mongorito solution.

ulpian avatar May 16 '16 11:05 ulpian

Is it possible to drop down to the native drive for the meantime?

devdebonair avatar May 16 '16 15:05 devdebonair

@devdebonair the issue with providing temporary solutions is that they become the norm and any future updates will have to be backward compatible, that's an issue if mongorito implements an active record style approach which will be really different to the native driver.

ulpian avatar May 16 '16 15:05 ulpian

I see your point. So what's the major issue holding this implementation back? I can try to spin up a PR.

devdebonair avatar May 16 '16 15:05 devdebonair

@devdebonair please do, I guess the major issue is essentially what that update operation would look like but feel free to propose what you think is best :)

ulpian avatar May 16 '16 15:05 ulpian