Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


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,