Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


When using Express with a SQL database, should you still create an object model similar to the mongoDB examples?

I don't think I'll have an opportunity to use any no SQL in my work for a while, so I was wondering what the difference in an Express app using mongoDB and an Express app using SQL server or MySQL.


I should add, that I've actually created an Express app using SQL server so I'm familiar with the driver and middleware set up, but I want to know best practices. Pretty sure what I made could use a good refactoring =)

1 Answer

Ken Alger
Ken Alger
Treehouse Teacher


Many things are very similar from a conceptual standpoint if you replace MongoDB with another database. You are still capturing the data in your app and storing it, it becomes the syntax of how it is done that is altered. There is also going to need to likely be an ORM layer with a SQL database that isn't needed when using MongoDB. Additionally, by going with a SQL database, you lose the flexibility of schema design that MongoDB provides (along with a host of other benefits).

If you have code to share for folks to take a look at, it would help for the "best practice" aspect of your question.

Happy coding,