mongorito
mongorito copied to clipboard
$push
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.
No, still no conclusion on this one. I have to delay this feature for future releases, in order to ship 2.0 faster.
while we wait for this enhancement, what's the current best practice to perform this action?
Unfortunately, none at the moment.
@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.
Is it possible to drop down to the native drive for the meantime?
@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.
I see your point. So what's the major issue holding this implementation back? I can try to spin up a PR.
@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 :)