Official MongoDB support

Native MongoDB would be great. It would make Yii the framework of choice for many academic and on the edge projects.

The new thing is expandability and interoperability and I can’t thing of a better way to do it.


I agree, native mongoDB support would be great!

I just wanted to add my thoughts to this:

For a long time I didn’t know what to think about all the NoSQL/schemaless DB buzz as I was used to MySQL and never had any real problems with using it. But I am currently working on a project where I want users to be able to add attributes to objects on the fly. This sounds terrible from an RDBMS point of view (usually enabled with EAV modelling which is known to be awfully slow) but is a perfect example for the usage of schemaless databases like MongoDB.

I think that applications like that (crowd sourced and flexible) aren’t a trend only but a new variant of designing applications as a whole.

I definitely think that adding an ActiveRecord like approach to connect to MongoDB, CoachDB or whatever would be highly beneficial for the whole Yii project. The only problem I see is that they all use completely different APIs as far as I know so adding DB-drivers could be a pain.

Anything you need that the existing MongoDb extensions doesn’t do?


yiimongodbsuite is what you need.

I know and use this extension already and it is extremely useful and well written. But I personally think that this whole topic is too big to be handled by an extension only approach. Building your whole application on top of an extension can be pretty scary for some businesses I think.

The benefits of a core implementation would be official documentation, additional tests when a new version of Yii is released, a solid team behind it fixing bugs or whatever. With an extension you will always have the problem of different versions of the same thing or "key developers" abandoning the project etc.

I agree with Haensel and I’d love to see official support for MongoDB.

if real,maybe the yii need refactor just because of so different between MongoDB and MySQL.

MySQL just for structured data focus on col.

MongoDB most like file system focus on row.

Merge to core

I agree with Haensel, too. I’d love to see MongoDB native in Yii project.

If yiimongodbsuite is a good candidate, why not merging it with code, as suggested by kernel.

Would be nice… +1 to add to core!

Nosql is here to be tested. There is a buzz around it because ppl want to use it and I agree yii has to do something about it officially. It is not just mongod, there other nosql solutions out there.

There are key value storage, document based, bigtable solutions.

I dont want yii to adopt and merge an extension code or even think that way at all. What I want to see is a solid api supporting more than 1 solutions even if it not so featured with development happiness.

For example dao would be sufficient in the beggining. And by dao I mean a solid layer, with a consistent api that would give my the ability to transparently change from the one nosql to the other by changing the connection string and a little or no more effort.

in the other hand I am not sure how an activerecord could be usefull on something schemaless.

+1 add to core.

i think it will be a great feature for 2.0 (adding mongodb into the core)

I don’t think it’s important for Yii to “officially” support MongoDb (or other NoSQL databases) if, when Yii 2.0 comes out, I can replace the entire DB module with anything I want (written by me or otherwise) and that works seamlessly with the rest of the framework.

It’s more important for the framework to be modular and have it’s components interchangeable than support every technology (new or old), because people will build what they need and share it with the community.

Sorry, Andy, but I’m not so sure about this.

mongoDB as mySQL is a living project, which means it has to be maintained also in the code sometimes.

The problem is what to do if there are 10 extensions for using only mongoDB?

Which to use? Which one will be up to date all the time and compatible with the newest mongoDB specs?

Until you do not choose one project for an official, it can happen that in some time you will have to

  • change the mongoDB extension which might be a stick in your head

  • update existing yourself which you might not have time for

And that’s only cause someone stopped to maintain his extension


I’m want to write a query "

SELECT * FROM page WHERE keyphrases NOT LIKE ‘%fghjkl%’ AND keyphrases LIKE ‘%abcde%’

" $criteria = new EMongoCriteria; $criteria->keyphrases(’!=’, new MongoRegex("/fghjkl/")); $criteria->addCond(‘keyphrases’,’==’, new MongoRegex("/abcde/"));

$clients = PageMongo::model()->findAll($criteria);

then I get an error 27017: invalid regular expression operator

what to do?