Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database.MongoDB.Query doesn't expose MongoDB's full update functionality #3

Open
mkscrg opened this issue Sep 5, 2012 · 2 comments
Assignees

Comments

@mkscrg
Copy link

mkscrg commented Sep 5, 2012

Database.MongoDB.Query doesn't expose the full power of mongo's update call. Here are a couple specific issues (not intended as a comprehensive list):

  • There's no way to make a call with both the MultiUpdate and Upsert flags.
  • There's no (semantic) way to make a modify call that only modifies one document or that does an upsert (or both, see previous).

The rest of the module does a good job of mirroring mongo's query API without restricting its use. So the update functions seem out of place, in that they sacrifice "advanced" usage in favor of several predetermined modes of operation.

I haven't dug into this very much, but it seems like you could just expose update (a private function in the Query module). The convenience functions (save, replace, repsert, etc.) could remain as such or be deprecated.

@ghost ghost assigned knsd Sep 9, 2012
@superbobry
Copy link

There's no way to make a call with both the MultiUpdate and Upsert flags.

What is the semantics of calling update with both these flags? Upsert means insert the document if there's nothing to update, while MultiUpdate updates 1+ existing documents. I think a more transparent way of achieving the behaviour you aim for is making two separate calls.

@gregwebs
Copy link

gregwebs commented Sep 2, 2013

I think the driver should expose an unrestricted interface (that it is possible for a user to shoot themselves in the foot with) in addition to a higher-level/safer interface for advanced use cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants