MongoDB\BSON\Javascript::getCode
(mongodb >=1.2.0)
MongoDB\BSON\Javascript::getCode — Returns the Javascript's code
Description
Parameters
This function has no parameters.
Return Values
Returns the Javascript's code.
Errors/Exceptions
- Throws MongoDB\Driver\Exception\InvalidArgumentException on argument parsing errors.
Examples
Example #1 MongoDB\BSON\Javascript::getCode() example
<?php
$js = new MongoDB\BSON\Javascript('function foo(bar) { return bar; }');
var_dump($js->getCode());
?>
The above example will output:
string(33) "function foo(bar) { return bar; }"