Need advice about which tool to choose?Ask the StackShare community!
Mongoose vs TypeORM: What are the differences?
What is Mongoose? MongoDB object modeling designed to work in an asynchronous environment. Let's face it, writing MongoDB validation, casting and business logic boilerplate is a drag. That's why we wrote Mongoose. Mongoose provides a straight-forward, schema-based solution to modeling your application data and includes built-in type casting, validation, query building, business logic hooks and more, out of the box.
What is TypeORM? An ORM that can run in NodeJS and others. It supports both Active Record and Data Mapper patterns, unlike all other JavaScript ORMs currently in existence, which means you can write high quality, loosely coupled, scalable, maintainable applications the most productive way.
Mongoose belongs to "Object Document Mapper (ODM)" category of the tech stack, while TypeORM can be primarily classified under "Microframeworks (Backend)".
Mongoose and TypeORM are both open source tools. Mongoose with 19K GitHub stars and 2.63K forks on GitHub appears to be more popular than TypeORM with 13.9K GitHub stars and 1.75K GitHub forks.
PedidosYa, Accenture, and WebbyLab are some of the popular companies that use Mongoose, whereas TypeORM is used by Sofit Software, Certain Lending, and KVIKYMART. Mongoose has a broader approval, being mentioned in 88 company stacks & 93 developers stacks; compared to TypeORM, which is listed in 6 company stacks and 7 developer stacks.
Pros of Mongoose
- Several bad ideas mixed together17
- Well documented17
- JSON10
- Actually terrible documentation8
- Recommended and used by Valve. See steamworks docs2
- Can be used with passportjs for oauth1
- Yeah1
Pros of TypeORM
- Typescript28
- Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Ser10
- Easy setup9
- Works in NodeJS, Browser, Ionic, Cordova and Electron p7
- Promise Based7
- Cons of TypeORM6
- Support MySQL & MariaDB, PostgreSQL, MSSQL, Sqlite6
- Support MongoDB1
Sign up to add or upvote prosMake informed product decisions
Cons of Mongoose
- Model middleware/hooks are not user friendly3
Cons of TypeORM
- Completely abandoned by its creator5
- Too complex for what it does3
- Doesn't really support native javascript2
- Cannot use query on any relation1
- Not proper/real type safety1