MongoDB\BSON\Javascript::getCode

Returns the Javascript's code

Description

final public string MongoDB\BSON\Javascript::getCode()

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; }"

See Also