Skip to content

When updating most of the document gets removed #18

@StorytellerCZ

Description

@StorytellerCZ

Run into this strange error just recently. I'm subscribed to profiles collection (from socialize:profiles - have it locally for Meteor 3) through the app. In my text editor I have triggered a function to change a field on my profile like this:

Meteor.methods({
'profile.readerSettings.darkMode': async (setTo: boolean) => {
    check(setTo, Boolean)
    const userId = Meteor.userId()
    if (!userId) throw notAuthorized
    return await ProfilesCollection.updateAsync(
      { _id: userId },
      { $set: { 'readerSettings.darkMode': setTo } },
    )
  },
})

Strangely though the profile document gets replaced with the change and two extra fields. Which results in other important fields missing. Calling other methods around the editor that also change the readerSettings then adds other fields back in.

Removing and adding the package seemed to fix the issue (which is why I was able to pin it to this package).

Then I found that if the offline package is last in the packages file then the problem does not occur. So maybe the package needs to be loaded after all the packages with collections have been loaded to prevent this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions