I did not know the datasource could do this and almost didn't try it
as a result. Don't make the same mistake.

Yasushi Ichikaway has developed a very nice datasource for MongoDB.
http://github.com/ichikaway/mongoDB-Datasource/

Mars Story wrote a very nice intro post about it.
http://mark-story.com/posts/view/using-mongodb-with-cakephp

After looking at the github page and reading Mark's post I was
convinced that only ordinary scalar values were supported by the
MongoDB datasource. The source lists only strings, integers and stuff
as datatypes... not objects, arrays or hierarchies in any form.

The good news is that deep nested arrays of data are supported. THis
is a big deal and I don't want anyone else to give this plugin a pass
just because they draw the same conclusions I did.

>From my experience, any field defined in the schema can be an array
and contain any hierarchical data. I have given these fields the
datatype "array" without an error just to indicate to myself that they
are hierarchies.

I have not been able to just add a new "root level" field but anything
inside a defined field can have any data structure added to it.

Example:
var $mongoSchema = array(
    'some_string' => array('type'=>'string'),
    'data'=>array('type'=>'array'), // just a reminder for me
    'created'=>array('type'=>'datetime'),
    'modified'=>array('type'=>'datetime'),
);

For this model I can save anything inside data. Like:
$this->data['Modelname']['data']['hello']['world'] = 'cool';

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to