We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Phalcon 4 support for ODM (MongoDB)

Does Phalcon 4 support for MongoDB yet ? I see that PHP already has a module for MongoDB. The fast of Phalcon should work with MongoDB :)



1.9k

hope someone can help me with this problem

edited Feb '19

https://github.com/phalcon/cphalcon/milestone/21

Phalcon 4 only reached 2/3 of it's milestone goals. I wouldn't use that branch for anything just yet.

From the 3.2 docs:

Please note that if you are using the Mongo driver provided by PHP 7, the ODM will not work for you. There is an incubator adapter but all the Mongo code must be rewritten (new Bson type instead of arrays, no MongoId, no MongoDate, etc…). Please ensure that you test your code before upgrading to PHP 7 and/or Phalcon 3+

The incubator db adapters:

https://github.com/phalcon/incubator/tree/master/Library/Phalcon/Db/Adapter

Another similar topic:

https://forum.phalcon.io/discussion/16205/how-to-configure-mongodb-in-phalcon-3

Currently You need to modify Phalcon code to fix Class/namespace typos to work properly, compile it by your self. Not sure if it is planned to fix old code from maintainers, because new ODM infrastracture will be added somewhere in 4.x, but not in 4.0 release (?based on rumors).

But fixed code works well with Incubator adapter.



1.9k

thank you all