Realm Sync - How to synchronize documents that have been corrected?

Hi everyone! Some time ago I got a notification about documents that are unsynced - they went to the unsynced_documents collection in __realm_sync.

I had 336 such documents - it turned out that they were not synchronized, because one of the fields had an incorrect format (int instead of string).

Using the command in _MONGOSH, I updated the unsynced documents to have the correct structure - of course, I updated them in the actual collection (I did not touch the unsynced_documents collection).

Currently, all documents have the correct structure, but the collection of unsynced_documents has not been updated.

Is there any way to make the unsynced_documents collection empty again?

Hi, updating those documents should cause sync to see those changes and resume syncing the documents (it will resync the entire document, not just the one change). Did this not happen? (I assume so from your comment).

I am curious if the number of documents went down at all and if there are possibly other reasons the documents are unsyncable.

If you can send a link to your application in services.cloud.mongodb.com I can take a look to see if anything looks off.

Best,
Tyler

There is a reason field in the documents of the unsynced_documents collection. In the reason it says that the field should be string, but it is int64. The field has been corrected, and the documents in unsynced_documents still exist.

services.cloud.mongodb.com/groups/62822cae0cfb803bd8c9e341/apps/63a5cdc25c766c7a43776b1c/dashboard

Hi, we have fairly extensive testing of this, so this is surprising to see. However, one thing that might make sense is that when a document has one error and then is updated to have a different error, we do not update that message.

Can you share how you updated the documents and perhaps provide a sample of the document now? One of the things that has tripped people up in the past is that fact that Int’s can be tricky to work with in javascript and it might have been updated to a double / float instead.

Problem solved! Another field was also in incorrect format which we did not notice and was not written about in the reason.

It would certainly be a helpful feature if the reason field would stay updated.

Thank you very much for your help!

Got it, I will file a ticket for that on our end. Not doing so is a performance optimization, but I think for the reasons outlined in this thread it might be causing more issues than it has benefits.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.