update : 2015.11.03
php.shukuma.com검색:
|
MongoCode::__construct(PECL mongo >= 0.8.3) MongoCode::__construct — Creates a new code object 설명
public MongoCode::__construct
( string
$code
[, array $scope = array()
] )인수
반환값Returns a new code object. 예제Example #1 MongoCode::__construct() example
<?php 위 예제의 출력 예시: 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; }" } Example #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 |