GithubHelp home page GithubHelp logo

MongoDB Migrations about mean HOT 4 CLOSED

meanjs avatar meanjs commented on June 6, 2024
MongoDB Migrations

from mean.

Comments (4)

amoshaviv avatar amoshaviv commented on June 6, 2024

Hi @naartjie,

This is an interesting idea since db migrations is usually a painful task. However I'm also not sure it would be best to include this in the core, so I'll mark it as an enhancement for the moment. We'll share this feature with the community and see what they think.

Cheers,
Amos

from mean.

martiserra avatar martiserra commented on June 6, 2024

Hi @naartjie, @amoshaviv,

I am just starting my first project with the MEAN stack, and I was thinking about kind of rails migration as well. Though I'm a experienced developer, I am relatively new to Javascript in the backend and the MEAN stack, so I would like to share here my thoughts regarding this topic and collect your feedback.

When talking about migrations I was thinking 2 types of migrations: schema migrations and data migrations, and the ability to versioning all of that.

  • Regarding schema migrations, since we're using Mongoose, I would say that the Schema does not reside in the database itself, but in the code, in every model we want persist to mongoDB. Thus, perhaps it makes no full sense to have migrations for that, since the code can be already versioned.
  • Regarding data migrations, I can imagine different uses cases that might be interesting, but probably all of them can be run with node-migrate framework:
    • Modifying all of the documents of a collection once its schema has been changed through code.
    • Adding kind of initial or static data to some collections for which you don't want to build the full CRUD

What is your view on that?

Cheers,
Martí

from mean.

naartjie avatar naartjie commented on June 6, 2024

Hi @martiserra and welcome to MEAN ;-)

You know what, I think you are right, I'm just having a browse through node-migrate, and it looks like not much is required to get it to work with Mongo.

I do think this is outside the scope of MEAN, and we should probably roll something independently. Let's keep each other updated if we do start something ;)

from mean.

NeverOddOrEven avatar NeverOddOrEven commented on June 6, 2024

I have added migration support to my projects using the mongodb driver and migrate (javascript w/ callbacks). I don't think adding migrations support is overly opinionated, especially since it can be done in isolation. I would advocate for a javascript solution over rails simply to maintain consistency, but I have heard rails has more advanced migration features.

from mean.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.