Request elegant way of updating content of rich text editor(tiptap) to mongodb

It may seem not to be a pure MongoDB problem, sorry for that.

I know that I can listen to onUpdate event and use editor.getJSON() to get changed content, then I can set this content through an API to the server. Then the server updates a field of MongoDB with the new value(I may store it as a JSON string).

I have a few concerns about the above simple design choice:

If the user only updates a small piece of document, I have to send full document JSON to the server and update the full content of the MongoDB field; all of these seem too costly.

In the frontend, I may use a throttle to reduce trigger frequency, but I still have to send full JSON. It may be a bottleneck as content increases with more text and images.

Can I only send the content change to the server like collaborative applications? But I have no requirement for collaborative editing between users. I only want to support fast client/server synchronization. Is Y.js a proper solution for me? If there are some better tools for me, please let me know.

And if we could send the change of content, can we update the partial JSON string on MongoDB? The content of tiptap may be a complex nested JSON. Is it possible?

1 Like

I’m personally interested in using y.js via hocuspocus.dev with Realm on top in the clients but I need to learn more about this possibility