MongoDB\BSON\Javascript::__construct Construct a new Javascript &reftitle.description; final public MongoDB\BSON\Javascript::__construct stringcode arrayobjectscope &reftitle.parameters; code (string) Javascript code. scope (arrayobject) Javascript scope. &reftitle.errors; &mongodb.throws.argumentparsing; Throws MongoDB\Driver\Exception\InvalidArgumentException if code contains null bytes. &reftitle.changelog; &Version; &Description; PECL mongodb 1.2.0 MongoDB\Driver\Exception\InvalidArgumentException is thrown if code contains null bytes. Previously, values would be truncated at the first null byte. &reftitle.examples; <function>MongoDB\BSON\Javascript::__construct</function> example 'bar']); var_dump($codews); ?> ]]> &example.outputs; string(24) "function() { return 1; }" ["scope"]=> object(stdClass)#2 (0) { } } object(MongoDB\BSON\Javascript)#2 (2) { ["javascript"]=> string(26) "function() { return foo; }" ["scope"]=> object(stdClass)#1 (1) { ["foo"]=> string(3) "bar" } } ]]> &reftitle.seealso; BSON Types