Handling migrations with MongoDb

后端 未结 3 1347
栀梦
栀梦 2020-12-31 06:05

Just to give a little more context to the question, I have a web application (asp mvc) which basically wraps CRUD operations to a MongoDb instance, it carries out validation

3条回答
  •  青春惊慌失措
    2020-12-31 06:53

    Strategies can be different. And they are depend on particular application. For sure for the sites like Facebook you will go with option #1 proposed by Derick to not hit your users at all, but if you have site that 'sells pizza' you for sure don't want make an effort to support both versions (current and new one), write more complex code, etc..

    For such kind of apps simple patching may be better option:

    1. Build server send application to 'Read mode', so anyone can read, but can't insert anything into database.
    2. While prod in read mode i am taking database and apply patch.
    3. Once patching done it make backup of database, stop web server, deploy new database and new application.

    Sending application to read mode allow to decrease downtime, but again for sites that's 'sells pizza' you don't need read mode.

提交回复
热议问题