From 166000d7b73881e594b5c0c6517b5ef615ecb06a Mon Sep 17 00:00:00 2001 From: Kristina Chodorow Date: Tue, 24 Mar 2009 18:25:46 +0000 Subject: [PATCH] adding code datatype git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@277701 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/mongo/mongocode.xml | 70 +++++++++++++++++ reference/mongo/mongoid/construct.xml | 105 ++++++++++++++++++++++++++ reference/mongo/mongoid/tostring.xml | 77 +++++++++++++++++++ 3 files changed, 252 insertions(+) create mode 100644 reference/mongo/mongocode.xml create mode 100644 reference/mongo/mongoid/construct.xml create mode 100644 reference/mongo/mongoid/tostring.xml diff --git a/reference/mongo/mongocode.xml b/reference/mongo/mongocode.xml new file mode 100644 index 0000000000..c3d2365970 --- /dev/null +++ b/reference/mongo/mongocode.xml @@ -0,0 +1,70 @@ + + + + + + The MongoCode class + MongoCode + + + + +
+ &reftitle.intro; + + Represents JavaScript code for the database. + + + MongoCode objects are composed of two parts: a string of code and an optional scope. The string of code must be valid JavaScript. The scope is a associative array of variable name/value pairs. + +
+ + +
+ &reftitle.classsynopsis; + + + + MongoCode + + + + + MongoCode + + + + + Methods + + + + +
+ +
+ + &reference.mongo.entities.mongocode; + +
+ + diff --git a/reference/mongo/mongoid/construct.xml b/reference/mongo/mongoid/construct.xml new file mode 100644 index 0000000000..89ff994c76 --- /dev/null +++ b/reference/mongo/mongoid/construct.xml @@ -0,0 +1,105 @@ + + + + + + MongoCode::__construct + Creates a new code object + + + + &reftitle.description; + + MongoCode::__construct + stringcode + arrayscopearray() + + + + + &reftitle.parameters; + + + + + code + + + + A string of code. + + + + + + scope + + + + The scope to use for the code. + + + + + + + + + &reftitle.returnvalues; + + Returns a new code object. + + + + + &reftitle.examples; + + <function>MongoCode::__construct</function> example + + 4)); +var_dump($code); + +?> +]]> + + &example.outputs.similar; + + + array(1) { + ["x"]=> + int(4) + } + ["code"]=> + string(80) "function(x) { for(i=0;i<10;i++) { db.foo.update({x:i}, {x:i+1}); } return x-1; }" +} +]]> + + + + + + diff --git a/reference/mongo/mongoid/tostring.xml b/reference/mongo/mongoid/tostring.xml new file mode 100644 index 0000000000..5c22ae86cc --- /dev/null +++ b/reference/mongo/mongoid/tostring.xml @@ -0,0 +1,77 @@ + + + + + + MongoCode::__toString + Returns this code as a string + + + + &reftitle.description; + + public stringMongoCode::__toString + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + This code, the scope is not returned. + + + + + &reftitle.examples; + + <function>MongoCode::__toString</function> example + +"hi")); +echo "$code\n"; + +$code = new MongoCode('function() { for(i=0;i<10;i++) { db.foo.update({x:i}, {x:i+1}); } }'); +echo "$code\n"; + +?> +]]> + + &example.outputs.similar; + + + + + + + +