MongoCode::__constructCreates a new code object 
 Beschreibung
   public  MongoCode::__construct
    ( string  
 $code
   [, array $scope = array()
  ] )Parameter-Liste
 
 RückgabewerteReturns a new code object. BeispieleBeispiel #1 MongoCode::__construct example 
<?phpDas oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie: 
object(MongoCode)#1 (2) {
  ["scope"]=>
  array(1) {
    ["x"]=>
    int(4)
  }
  ["code"]=>
  string(80) "function() { for(i=0;i<10;i++) { db.foo.update({z : i}, {z : x}); } return x-1; }"
}
Beispiel #2 Using MongoCode with $where This example queries a collection for elements where the 'x' fields is less than $y. Notice that PHP objects can be passed into the JavaScript scope and that the JavaScript function returns a boolean. 
<?php |