Hybrid deployments with PHP Laravel MySQL + MongoDB

0

I'm developing a system with PHP Laravel + MongoDB .

The login part and password will be modeled using MySQL and I will use MongoDB to do a quiz . I was thinking of putting a Schema in% with% of this type:

var quiz = [{

    user_id: 1, //Auth::id() | O id do user vai vir do Auth do php laravel
    name: "Quiz 1",
    question: [{
        title: 'question1',
        type: 'radio',
        elements: ['radio1', 'radio2', 'radio3', 'radio4'],
        correct: ['radio1'],
        resposta: ['radio3'] //errou
    },{
        title: 'question 2',
        type: 'checkbox',
        elements: ['checkbox1', 'checkbox2', 'checkbox3', 'checkbox4'],
        correct: ['checkbox1', 'checkbox2'],
        resposta: ['checkbox1','checkbox2'] //acertou
    }]
}];

Is it usually a hybrid deployment of two banks in projects?

    
asked by anonymous 04.05.2017 / 22:51

1 answer

0

The answer to your final question is: it depends. If you want to do a hybrid implementation without problems, think carefully about the justifications for doing so (or not doing). Considerations / questions that occur to me to help decide:

  • Do you already have users in MySQL? Is it possible to migrate them to MongoDB if this is the case?
  • Want to take advantage of the referential integrity (joins) that MySQL already offers you?
  • Want to take advantage of the flexibility to change the schema in MongoDB? (remember the 16MB document size limit)
  • If you use two banks you will need to manage two banks! two backups, two processes, two query optimizations ...
  • Can your system grow for many users / base size / traffic that would justify the scalability of MongoDB?
  • Like the @Virgilio Novic comment, do you have experience with using / admin on MongoDB? Maybe you want to use the project just to get the experience.
06.05.2017 / 01:23