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

Provide option to overwrite pre-existing documents #81

Open
SkeloGH opened this issue Jan 4, 2020 · 0 comments
Open

Provide option to overwrite pre-existing documents #81

SkeloGH opened this issue Jan 4, 2020 · 0 comments
Labels
enhancement New feature or request medium priority

Comments

@SkeloGH
Copy link
Owner

SkeloGH commented Jan 4, 2020

Is your feature request related to a problem? Please describe.
Pre-existing documents aren't updated if fresher info is available

Describe the solution you'd like
Provide a feature gate mechanism that allows to turn on or off updating documents.

Describe alternatives you've considered
Manually overriding documents that aren't copied

Additional context

This is the current implementation where it's decided to return the already saved document.

  • src/clients/mongodb/index.js
saveDocument = (document) => {
    const collection = document.dataSet;
    const { _id } = document.data;
    const query = { _id };

    return this.db.collection(collection)
      .findOne(query)
      .then((result) => {
        if (result) return this.handleSavedDocument(result);
        return this.db.collection(collection).insertOne(document.data);
      });
  }
@SkeloGH SkeloGH added enhancement New feature or request medium priority labels Jan 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request medium priority
Projects
None yet
Development

No branches or pull requests

1 participant