Core: Doctrine ORM is a required dependency. But what if use MongoDB and DoctrineODM?

Created on 23 Nov 2018  路  6Comments  路  Source: api-platform/core

As told, I didn't installed Doctrine (ORM) Bundle, but instead installed Doctrine ODM Bundle to use ApiPlatform with MongoDB.

But as ApiPlatform requires DoctrineBundle, I have it anyway installed and its Flex recipe executed, so my configuration is full of references to Doctrine ORM (.env and config folder).

I think that someone should be free to choose if (s)he wants to install the ORM or the ODM, without being forced to install the ODM, too.

What do you think about this?

question

Most helpful comment

@dunglas , as ever you are the best!

I thought of Postgres, but as my experience is limited to MySQL, I'm not able to compare MongoDB and Postgres... I was fascinated, anyway, by Postgres as I heard it is really great...

I will start using it as now is easier than later: thank you!

About the dependency, yes, I installed the pack, not the core platform... revealed the mystery :)

Thank you again @dunglas , you were very precious with the advice about the database!

All 6 comments

The support of MongoDB ODM is not yet merged (https://github.com/api-platform/core/pull/2144), so currently you can't choose to use MongoDB.

馃槗I saw this issue closed and thought it was merged...

https://github.com/api-platform/core/pull/1293

Thank you for your comment.

A stupid question: any ideas about how it will be merged?

I saw the todo list and unfortunately I'm not able to contribute as I never used MongoDB, so I'm not able to understand what is a bug and what is an error of mine :(

No problem :slightly_smiling_face: WDYM by "how" it will be merged?

An estimated date if there is one set...

I'm building an application that can run much faster using MongoDB and I have to decide if it is better to wait for the merge or if it is better to start developing it using MySQL (a nightmare as there are a lot of data to store!) and then face the problem of migrating data from MySQL to MongoDB (another nightmare! )...

But as ApiPlatform requires DoctrineBundle, I have it anyway installed and its Flex recipe executed, so my configuration is full of references to Doctrine ORM (.env and config folder).

API Platform doesn't depend of Doctrine ORM. The only required deps are these ones: https://github.com/api-platform/core/blob/master/composer.json#L18-L27

You're free to use the persistence layer you want.

You probably installed the pack (which comes with Doctrine ORM), but you can cherry-pick your deps by installing api-platform/core directly, or by unpacking the API pack.

I'm building an application that can run much faster using MongoDB and I have to decide if it is better to wait for the merge or if it is better to start developing it using MySQL

You should probably consider using Postgres, which performance close to Mongo, and is supported by Doctrine ORM. That being said, even MySQL/MariaDB are often enough for large data sets.

@dunglas , as ever you are the best!

I thought of Postgres, but as my experience is limited to MySQL, I'm not able to compare MongoDB and Postgres... I was fascinated, anyway, by Postgres as I heard it is really great...

I will start using it as now is easier than later: thank you!

About the dependency, yes, I installed the pack, not the core platform... revealed the mystery :)

Thank you again @dunglas , you were very precious with the advice about the database!

Was this page helpful?
0 / 5 - 0 ratings