MongoDB\BSON\Javascript::getScope

(mongodb >=1.2.0)

MongoDB\BSON\Javascript::getScopeReturns the Javascript's scope document

说明

final public MongoDB\BSON\Javascript::getScope ( void ) : object|null

参数

此函数没有参数。

返回值

Returns the Javascript's scope document.

错误/异常

范例

Example #1 MongoDB\BSON\Javascript::getScope() example

<?php

$js 
= new MongoDB\BSON\Javascript('function foo(bar) { return bar; }');
var_dump($js->getScope());

$js = new MongoDB\BSON\Javascript('function foo() { return foo; }', ['foo' => 42]);
var_dump($js->getScope());

?>

以上例程会输出:

NULL
object(stdClass)#1 (1) {
  ["foo"]=>
  int(42)
}
相关文章
php mongodb bson the mongodb bson javascript classphp mongodb bson dbpointer returns a representation that can be converted to jsonphp mongodb bson dbpointer returns an empty stringphp mongodb bson javascript construct a new javascriptphp mongodb bson javascript returns the javascript s codephp mongodb bson javascript returns the javascript s scope documentphp mongodb bson javascript returns a representation that can be converted to jsonphp mongodb bson javascript returns the javascript s codephp mongodb bson javascriptinterface returns the javascriptinterface s scope documentphp mongodb bson objectid returns the timestamp component of this objectidphp mongodb bson regexinterface returns the regexinterface s flagsphp mongodb bson regexinterface returns the regexinterface s patternphp mongodb bson regexinterface returns the string representation of this regexinterfacephp mongodb bson timestampinterface returns the increment component of this timestampinterfacephp mongodb bson timestampinterface returns the timestamp component of this timestampinterfacephp mongodb bson utcdatetimeinterface returns the datetime representation of this utcdatetimeinterfacephp mongodb bson utcdatetimeinterface returns the string representation of this utcdatetimeinterfacephp mongodb driver monitoring commandfailedevent returns the command reply documentphp mongodb driver monitoring commandsucceededevent returns the command reply documentphp mongodb driver writeconcern returns an object for bson serialization
关注编程学问公众号