CodeWithScope

public struct CodeWithScope : BSONValue, Equatable, Codable

A struct to represent the BSON Code and CodeWithScope types.

  • A string containing Javascript code.

    Declaration

    Swift

    public let code: String
  • An optional scope Document containing a mapping of identifiers to values, representing the context in which code should be evaluated.

    Declaration

    Swift

    public let scope: Document?
  • Declaration

    Swift

    public var bsonType: BSONType { get }
  • Initializes a CodeWithScope with an optional scope value.

    Declaration

    Swift

    public init(code: String, scope: Document? = nil)
  • Declaration

    Swift

    public init(from decoder: Decoder) throws
  • Declaration

    Swift

    public func encode(to: Encoder) throws
  • Declaration

    Swift

    public func encode(to storage: DocumentStorage, forKey key: String) throws
  • Declaration

    Swift

    public static func from(iterator iter: DocumentIterator) throws -> CodeWithScope