Have you seen this post yet? http://mark-story.com/posts/view/using-mongodb-with-cakephp Check the post comments. There's one in there about the primary key issue.
On Apr 15, 1:42 am, zulfiqar <[email protected]> wrote: > Hi, > > I am planning to use mongoDB as database for my application. I found > mongoDB datasource here (http://github.com/ichikaway/mongoDB- > Datasource). and managed to connect and retrieve data from the mongoDB > but when doing insertion, I noticed some problem. It seems that > cakephp does not properly insert integer (or maybe float) values to > mongoDB. I've defined a schema that define one column as type integer, > by right CakePHP should typecast (intval) the values that will be > written to the table but unfortunately not. > > in mongoDB_source.php, the $column array is defined as > var $columns = array( > 'string' => array('name' => 'varchar'), > 'text' => array('name' => 'text'), > 'integer' => array('name' => 'integer', 'formatter' => > 'intval'), > 'float' => array('name' => 'float', 'formatter' => > 'floatval'), > 'datetime' => array('name' => 'datetime', 'format' => 'Y-m-d > H:i:s', 'formatter' => 'date'), > 'timestamp' => array('name' => 'timestamp', 'format' => 'Y-m-d > H:i:s', 'formatter' => 'date'), > 'time' => array('name' => 'time', 'format' => 'H:i:s', > 'formatter' => 'date'), > 'date' => array('name' => 'date', 'format' => 'Y-m-d', > 'formatter' => 'date'), > ); > > and I have defined a mongoSchema in one of my model as > var $mongoSchema = array( > 'id' => array('type' => 'integer'), > 'timetag_date' => array('type' => 'datetime'), > 'description' => array('type' => 'string'), > 'status' => array('type' => 'string'), > 'user_id' => array('type' => 'integer') > ); > > I suspect CakePHP does not used the formatter for the integer field, I > have gone through the code at model.php and can't find any line that > using the formatter field. > > anybody using mongoDB with CakePHP here that can verify this? and > probably a way to overcome this > > thanks 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 To unsubscribe, reply using "remove me" as the subject.
