Method: BSON::CodeWithScope#as_extended_json

Defined in:
lib/bson/code_with_scope.rb

#as_extended_json(**options) ⇒ Hash

Converts this object to a representation directly serializable to Extended JSON (github.com/mongodb/specifications/blob/master/source/extended-json/extended-json.md).

Parameters:

  • opts (Hash)

    a customizable set of options

Returns:

  • (Hash)

    The extended json representation.

Since:

  • 2.0.0



73
74
75
# File 'lib/bson/code_with_scope.rb', line 73

def as_extended_json(**options)
  { "$code" => javascript, "$scope" => scope.as_extended_json(**options) }
end