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

Add collection:migrate command #168

Merged
merged 4 commits into from
Jan 11, 2023
Merged

Add collection:migrate command #168

merged 4 commits into from
Jan 11, 2023

Conversation

Aschen
Copy link
Contributor

@Aschen Aschen commented Nov 16, 2022

What does this PR do?

Adds a command to migrate documents from a dump created with Kourou.

The command takes a script to migrate the content of a document and a path to a collection dump.

Example of migration function

// save this in "migration.js"

function migrate(document) {
  const [firstName, lastName] = document.body.name.split(' ');

  return {
    _id: document._id,
    body: {
      firstName,
      lastName,
    }
  };
}

Then run kourou collection:migrate ./migration.js path/to/dump/

Copy link
Contributor

@OlivierCavadenti OlivierCavadenti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but update README (add to commands list + doc)

@rolljee rolljee merged commit 2a6d26a into 1-dev Jan 11, 2023
@rolljee rolljee deleted the feat/migrate branch January 11, 2023 10:15
@rolljee rolljee mentioned this pull request Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants