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

Borrow operators from Mongo? #22

Open
ethanresnick opened this issue Feb 21, 2018 · 2 comments
Open

Borrow operators from Mongo? #22

ethanresnick opened this issue Feb 21, 2018 · 2 comments

Comments

@ethanresnick
Copy link

Mongo's patch document format probably wouldn't make sense to copy/standardize directly, as it has some pretty big limitations (e.g., it's only possible to apply one operation to each document field) and it doesn't target values with JSON Pointer, so in that sense it doesn't compose well with existing standards.

That said, Mongo does have a pretty extensive set of update operators that have, presumably, proven themselves to be sufficient after/through pretty heavy developer use. (After all, I imagine Mongo's document patching format is by far the most widely-used JSON patch format.) Maybe these operators could offer a good starting point for JSON Patch 2?

@HappyNomad
Copy link

I've built the front-end of a large mobile app that communicates user changes to the back-end via the JSON Patch derivative I described in #20. The back-end is coming along well, and next I must apply #20-style operations to data in Mongo. I plan to code a layer that translates those operations into Mongo's update format.

While developing this mobile app, I've also created a .NET Standard 2.0 client-side library that tracks changes to domain objects and packages them into a #20-style document. I envision this library becoming a full-fledged synchronization framework for occasionally-connected mobile apps. I'd love to eventually make it open-source to promote the adoption of JSON Patch by document databases like Mongo.

Now I must focus on translating the #20-style operations to Mongo updates. As with the client-side library, I hope to make this server-side translation code open-source, too. Is anyone interested in potentially using or helping further develop these? The client-side library is polished and done, but the server-side one is a work-in-progress. In particular, I could use help interpreting Mongo updates in terms of #20-style operations.

@mitar
Copy link

mitar commented Oct 12, 2019

I would be against it. That should probably be a completely different standard. The beauty of JSON patch is that it is simple. MongoDB is complicated. There are also many special cases and edge cases which have to be handled differently. Also, the original query language was not enough and recently they had to add more queries to support like modifying arrays in multiple places at once and so on. So I would say that from my observation the language is far from complete and is changing all the time.

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

No branches or pull requests

3 participants