Class: Mongo::Code

Inherits:
String show all
Defined in:
lib/mongo/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.



30
31
32
33
# File 'lib/mongo/types/code.rb', line 30

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

Instance Attribute Details

#scopeObject

Hash mapping identifiers to their values



23
24
25
# File 'lib/mongo/types/code.rb', line 23

def scope
  @scope
end