Hi Mark,

Is it possible for MongoDB to be incorporated as part of the CakePHP ORM features together with the likes of Mysql and Oracle? Thanks!

liaogz on 2/26/13

liaogz: There is some challenges in doing that. Mongo has a number of differences from SQL datastores that make implementing features like associations challenging. Because mongo can store associated records as sub-documents associations like hasMany are implemented very differently. Also a habtm relationship would not need a join table as mongo doesn’t support joins natively. I’m not saying that supporting mongo is impossible, but it changes how you use associations. My hope is that association types in CakePHP 3.0 are extensible enough that we can add specialized types like hasMany implemented as nested documents.

mark story on 2/26/13

sudo pecl install mongo WHAT IS THIS ACTUALLY MEANS………EITHER I WANT INSTALL OR SOMETHING I COULDN’T UNDERSTAND…..PLZ SOMEONE HELP ME WITH HOW TO INTEGRATE PHP WITH MONGODB……………

Sindhu Gunasekaran on 3/7/13

Sindhu Gunasekaran: Its a shell command that you run to install the mongo C extension. It will download, compile and install a small C library that provides the Mongo related classes you’ll need to integrate PHP + mongo together.

mark story on 3/7/13

The database.php entry needs to be something like this:

public $mongo = array(
    'datasource' => 'Mongodb.MongodbSource', //This needs to be properly camelized :)
    'database' => 'my_test',
    'host' => 'localhost',
    'port' => 27017
);

Wenbert on 5/22/13

Unquestionably believe that which you said. Your favorite justification
appeared to be on the web the easiest thing to be aware of.
I say to you, I definitely get irked while people think about
worries that they just do not know about.
You managed to hit the nail upon the top and defined out the whole thing without having side effect , people can take a signal.
Will probably be back to get more. Thanks

trends in kitchens on 7/8/13

Conceptually CakePHP is a framework that rests on top of a relational DB – it maps tables to models to controllers really well and powerfully. NoSql applications normally have a more domain centred design – would you say CakePHP is really set up efficiently for a noSql styled implementation?

derek on 8/20/13

Derek: I wouldn’t say it is ill suited but you are right that it may not be the optimal pairing of tools. Due to the lack of Entity objects several tasks with mongodb are going to be harder. With that said there isn’t any reason you couldn’t combine CakePHP with a more mongo friendly ORM.

mark story on 8/24/13

heya,

i’ve already cloned the mongo datasource plugin into my cake implementation and added the mongo database settings as described in this post.
But still when i try to browse the coresponding controller and poppulate the database (after creating it),there it throws an error:
Fatal Error

Error: Class ‘Mongo’ not found
File: /path/to/cake/app/lib/Cake/Model/ConnectionManager.php
Line: 107

How can i get this fixed?

Konstantinos on 10/22/13

Konstantinos: You need to install the mongo PECL extension. On most *nix machines you can do this with sudo pecl install mongo. If you are on windows you’ll need to find a binary and install it by hand.

mark story on 10/27/13

Hey! I just wanted to ask if you ever have any problems with hackers?

My last blog (wordpress) was hacked and I ended up losing
several weeks of hard work due to no back up. Do you have any solutions to prevent hackers?

pinion on 2/20/14

Hello Mark
with new version of cakephp, i get this error
Error: Class ‘Mongo’ not found
File: /home/netslr2/lib/Cake/Model/ConnectionManager.php
Line: 105

mifadir on 4/23/14

mifadir: You probably need to install/enable the Mongo extension.

mark story on 4/25/14