• Stars
    star
    339
  • Rank 124,341 (Top 3 %)
  • Language
    PHP
  • Created about 14 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[Abandon Project] MongoDB database driver for CakePHP

mongoDB datasource for CakePHP (Abandon Project)

Build Status Coverage Status

IMPORTANT

Sorry. This project is no longer maintained!

Requirements

Installation

this repository should be installed in the same way as any other plugin.

To install the driver for use in a single application:

cd my/app/Plugin
git clone git://github.com/ichikaway/cakephp-mongodb.git Mongodb

To install the driver for use in any/multiple application(s)

# where ROOT is the name of the directory parent to the base index.php of CakePHP.
cd ROOT/Plugin
git clone git://github.com/ichikaway/cakephp-mongodb.git Mongodb

composer

This plugin on the Packagist.

https://packagist.org/packages/ichikaway/cakephp-mongodb

Sample Code

To use this DB driver, install (obviously) and define a db source such as follows:

<?php
//app/Config/bootstrap.php
CakePlugin::load('Mongodb');


// app/Config/database.php
class DATABASE_CONFIG {
	public $default = array(
		'datasource' => 'Mongodb.MongodbSource',
		'host' => 'localhost',
		'database' => 'blog',
		'port' => 27017,
		'prefix' => '',
		'persistent' => 'true',
		/* optional auth fields
		'login' => 'mongo',	
		'password' => 'awesomeness',
		'replicaset' => array('host' => 'mongodb://hoge:hogehoge@localhost:27021,localhost:27022/blog', 
		                      'options' => array('replicaSet' => 'myRepl')
				     ),
		*/
	);

	// To make sure all tests are passing create the following entry in app/Config/database.php
	public $test = array(
		'datasource' => 'Mongodb.MongodbSource',
		'database' => 'test_mongo',
		'host' => 'localhost',
		'port' => 27017,
	); 
}

More detail of replicaset in wiki: https://github.com/ichikaway/cakephp-mongodb/wiki/How-to-connect-to-replicaset-servers

Model files need to have mongoSchema property - or make use of the schemaless behavior.

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.

Before you start, you may find it useful to see a model sample. There are also some sample controller actions: find,save,delete,deleteAll,updateAll note that your controller code needs no specific code to use this datasource.

Author

Yasushi Ichikawa (ichikaway)

More Repositories

1

mongoDB-Datasource

Old and Historical repository. Please use new repository at: http://github.com/ichikaway/cakephp-mongodb
PHP
85
star
2

cakeplus

adding some functions to cakephp
PHP
52
star
3

nschecker

DNS record changing detection tool with slack notification.
Go
51
star
4

goNES

NES emulator written in golang
Go
21
star
5

xformHelper

extends cakephp form helper.
PHP
18
star
6

AutoAppBuild

AutoAppBuild finds sub directories in Controller/Model directory and executes App::build()
PHP
12
star
7

securephp

SecurePHP is the library for security
PHP
8
star
8

aite9

port close check scanner. detects open ports, sends alert with slack.
Go
8
star
9

cakephp-MissingDetect-Plugin

check property name
PHP
5
star
10

Symfony2-PerformanceCheckSample

Symfony2-PerformanceCheckSample
PHP
5
star
11

dnscop

DNSCOP: DNS Proxy to control youtube time for kids
Go
4
star
12

CakeEpicSaxGuy

Play Epic Sax Guy video when test failed.
PHP
4
star
13

Codeigniter2-PerformanceCheckSample

Codeigniter2-PerformanceCheckSample
PHP
2
star
14

cakephp-mongodb-samples

Sample applications using MongoDB driver for CakePHP (http://github.com/ichikaway/cakephp-mongodb)
2
star
15

cakephp-2FactorAuth-SMS

Sample code of 2 factor auth using Twilio SMS for CakePHP.
PHP
2
star
16

WebDB-65-sample-2

CakePHP2.0 sample app
PHP
2
star
17

CakePHP-PerformanceCheckSample

CakePHP-PerformanceCheckSample
PHP
2
star
18

ImageBehaviorNeo

CakePHP ImageBehavior neo(adding validation rules, can set any directry and file path)
PHP
2
star
19

testrepo2

test
1
star
20

WebDB-65-sample

WebDB-65-sample
PHP
1
star
21

assembler-sample

x86_64 sample
Assembly
1
star
22

vim

Vim Script
1
star
23

matsunitter

CakePHP matsuri findTwitter unit test sample code
PHP
1
star
24

Yii_and_Pinoco-PerformanceCheckSample

Yii and Pinoco-PerformanceCheckSample
PHP
1
star
25

Lithium-PerformanceCheckSample

Lithium-PerformanceCheckSample
PHP
1
star