Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ichikaway/mongoDB-Datasource
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: lsmonki/mongoDB-Datasource
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 7 commits
  • 5 files changed
  • 2 contributors

Commits on Mar 25, 2012

  1. Copy the full SHA
    871a769 View commit details
  2. Fixed paths for Cake 2.0.

    Michael Radvak committed Mar 25, 2012
    Copy the full SHA
    1041c8d View commit details

Commits on Jun 11, 2012

  1. commit obligado

    lsmonki committed Jun 11, 2012
    Copy the full SHA
    d4c4864 View commit details
  2. Copy the full SHA
    c2aded2 View commit details
  3. Copy the full SHA
    f0e31ad View commit details
  4. Copy the full SHA
    c086f0d View commit details

Commits on Jun 12, 2012

  1. Copy the full SHA
    bcda997 View commit details
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.swp
.*
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 13 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
@@ -19,6 +19,12 @@ To install the driver for use in any/multiple application(s)
cd ROOT/plugins
git clone git://github.com/ichikaway/cakephp-mongodb.git mongodb

### Cake 2.0 Installation

Update /app/Config/bootstrap.php, add this line at the end of the file:

CakePlugin::load('mongodb');

## Sample Code

To use this DB driver, install (obviously) and define a db source such as follows:
@@ -28,7 +34,7 @@ To use this DB driver, install (obviously) and define a db source such as follow
class DATABASE_CONFIG {

public $mongo = array(
'driver' => 'mongodb.mongodbSource',
'datasource' => 'mongodb.mongodbSource',
'database' => 'driver',
'host' => 'localhost',
'port' => 27017,
@@ -42,6 +48,12 @@ Model files need to have mongoSchema property - or make use of the schemaless be

Mongo uses a primary key named "\_id" (cannot be renamed). It can be any format you like but if you don't explicitly set it Mongo will use an automatic 24 character (uu)id.

To use the "\_id" as the default primary key in CakePHP, change the `$primaryKey` property to "\_id" in your model or in the AppModel.

class AppModel extends Model {
public $primaryKey = '_id';
}

Before you start, you may find it useful to see [a model sample.](http://github.com/ichikaway/mongoDB-Datasource/blob/master/samples/models/post.php)
There are also some sample [controller actions: find,save,delete,deleteAll,updateAll](http://github.com/ichikaway/mongoDB-Datasource/blob/master/samples/controllers/posts_controller.php) note that your controller code needs no specific code to use this datasource.