Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB database on git repository

I'm preparing a git repository for me and my friend's fun project learning to make an images/videos sharing website. We're learning the MEAN stack along the way. Now only I have set up MongoDB /data/db and have been playing around with it.

The question is that, should I/can I make a data/db folder in the git repo so my friend can pull everything and see the images displaying on his browser? Or should I be the only one working on the database?

Also, any tips or advice on deploying are welcome. Thank you.

like image 389
ramenatmidnight Avatar asked Sep 14 '25 18:09

ramenatmidnight


1 Answers

Theoretically, it could work. You can put your MongoDB database files under version control. When you commit the database files while MongoDB isn't running and your colleague pulls them while his MongoDB instance isn't running either, it should be possible to exchange the database content this way. At least as long as you are both using the same version of MongoDB.

However, it might not be a good idea to do this, because Git isn't built for large binary files which change often. Your repository might not perform as well as you would expect it from Git.

As an alternative solution, you could set up one MongoDB instance which you both access in parallel via network.

like image 118
Philipp Avatar answered Sep 17 '25 08:09

Philipp