column definition
Are we connected to the DataSource?
true - yes null - haven't tried yet false - nope, and we can't connect
Base Config
set_string_id: true: In read() method, convert MongoId object to string and set it to array 'id'. false: not convert and set.
Database Instance
Default schema for the mongo models
Mongo Driver Version
startTime property
If debugging is enabled, stores the (micro)time the current query started
construct method
By default don't try to connect until you need to
Destruct
begin method
Mongo doesn't support transactions
Calculate
Close database connection
commit method
MongoDB doesn't support transactions
Connect to the database
If using 1.0.2 or above use the mongodb:// format to connect The connect syntax changed in version 1.0.2 - so check for that too
If authentication information in present then authenticate the connection
Create Data
create connection name.
createSchema method
Mongo no care for creating schema. Mongo work with no schema.
Delete Data
For deleteAll(true, false) calls - conditions will arrive here as true - account for that and convert to an empty array For deleteAll(array('some conditions')) calls - conditions will arrive here as: array( Alias._id => array(1, 2, 3, ...) )
This format won't be understood by mongodb, it'll find 0 rows. convert to:
array( Alias._id => array('$in' => array(1, 2, 3, ...)) )
deriveSchemaFromData method
Describe
Automatically bind the schemaless behavior if there is no explicit mongo schema. When called, if there is model data it will be used to derive a schema. a row is plucked out of the db and the data obtained used to derive the schema.
Disconnect from the database
distinct method
dropSchema method
Return a command to drop each table
ensureIndex method
execute method
If there is no query or the query is true, execute has probably been called as part of a db-agnostic process which does not have a mongo equivalent, don't do anything.
get MongoDB Collection Object
get MongoDB Object
group method
array() Set params same as MongoCollection::group() key,initial, reduce, options(conditions, finalize)
Ex. $params = array( 'key' => array('field' => true), 'initial' => array('csum' => 0), 'reduce' => 'function(obj, prev){prev.csum += 1;}', 'options' => array( 'condition' => array('age' => array('$gt' => 20)), 'finalize' => array(), ), );
Inserts multiple values into a table
check connection to the database
isInterfaceSupported method
listSources is infact supported, however: cake expects it to return a complete list of all possible sources in the selected db - the possible list of collections is infinte, so it's faster and simpler to tell cake that the interface is /not/ supported so it assumes that <insert name of your table here> exist
Get list of available Collections
logQuery method
Set timers, errors and refer to the parent If there are arguments passed - inject them into the query Show MongoIds in a copy-and-paste-into-mongo format
mapReduce
Quotes identifiers.
MongoDb does not need identifiers quoted, so this method simply returns the identifier.
query method If call getMongoDb() from model, this method call getMongoDb().
Read Data
For deleteAll(true) calls - the conditions will arrive here as true - account for that and switch to an empty array
rollback method
MongoDB doesn't support transactions
setTimeout Method
Sets the MongoCursor timeout so long queries (like map / reduce) can run at will. Expressed in milliseconds, for an infinite timeout, set to -1
Deletes all the records in a table
Update Data
This method uses $set operator automatically with MongoCollection::update(). If you don't want to use $set operator, you can chose any one as follw.
Update multiple Record
Prepares a value, or an array of values for database queries by quoting and escaping them.
convertId method
$conditions is used to determine if it should try to auto correct _id => array() queries it only appies to conditions, hence the param name
prepareLogQuery method
Any prep work to log a query
Set empty values, arrays or integers, for the variables Mongo uses
stringify method
Takes an array of args as an input and returns an array of json-encoded strings. Takes care of any objects the arrays might be holding (MongoID);
Convert automatically array('Model.field' => 'foo') to array('field' => 'foo')
This introduces the limitation that you can't have a (nested) field with the same name as the model But it's a small price to pay to be able to use other behaviors/functionality with mongoDB
Documentation generated on Tue, 26 Jul 2011 01:09:01 +0900 by phpDocumentor 1.4.3