Class: BSON::Code

Inherits:
String
  • Object
show all
Defined in:
lib/bson/types/code.rb

Overview

JavaScript code to be evaluated by MongoDB.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, scope = {}) ⇒ Code

Wrap code to be evaluated by MongoDB.

Parameters:

  • code (String)

    the JavaScript code.

  • a (Hash)

    document mapping identifiers to values, which represent the scope in which the code is to be executed.



32
33
34
35
# File 'lib/bson/types/code.rb', line 32

def initialize(code, scope={})
  super(code)
  @scope = scope
end

Instance Attribute Details

#scopeObject

Hash mapping identifiers to their values



25
26
27
# File 'lib/bson/types/code.rb', line 25

def scope
  @scope
end