Module: BSON

Defined in:
lib/bson.rb,
lib/bson/code.rb,
lib/bson/date.rb,
lib/bson/hash.rb,
lib/bson/json.rb,
lib/bson/time.rb,
lib/bson/array.rb,
lib/bson/float.rb,
lib/bson/int32.rb,
lib/bson/int64.rb,
lib/bson/binary.rb,
lib/bson/config.rb,
lib/bson/object.rb,
lib/bson/regexp.rb,
lib/bson/string.rb,
lib/bson/symbol.rb,
lib/bson/boolean.rb,
lib/bson/integer.rb,
lib/bson/max_key.rb,
lib/bson/min_key.rb,
lib/bson/version.rb,
lib/bson/document.rb,
lib/bson/registry.rb,
lib/bson/date_time.rb,
lib/bson/nil_class.rb,
lib/bson/object_id.rb,
lib/bson/timestamp.rb,
lib/bson/undefined.rb,
lib/bson/decimal128.rb,
lib/bson/true_class.rb,
lib/bson/environment.rb,
lib/bson/false_class.rb,
lib/bson/open_struct.rb,
lib/bson/specialized.rb,
lib/bson/time_with_zone.rb,
lib/bson/code_with_scope.rb,
lib/bson/decimal128/builder.rb

Overview

Copyright (C) 2016 MongoDB Inc.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Defined Under Namespace

Modules: Array, Config, Date, DateTime, Environment, FalseClass, Float, Hash, Integer, JSON, NilClass, Object, OpenStruct, Regexp, Registry, Specialized, String, Symbol, Time, TimeWithZone, TrueClass Classes: Binary, Boolean, Code, CodeWithScope, Decimal128, Document, Int32, Int64, InvalidKey, MaxKey, MinKey, ObjectId, Timestamp, Undefined

Constant Summary collapse

BINARY =

Constant for binary string encoding.

Since:

  • 2.0.0

"BINARY".freeze
NO_VALUE =

Constant for bson types that don't actually serialize a value.

Since:

  • 2.0.0

"".force_encoding(BINARY).freeze
NULL_BYTE =

Constant for a null byte (0x00).

Since:

  • 2.0.0

0.chr.force_encoding(BINARY).freeze
UTF8 =

Constant for UTF-8 string encoding.

Since:

  • 2.0.0

"UTF-8".freeze
VERSION =
"4.3.0".freeze

Class Method Summary collapse

Class Method Details

.ObjectId(string) ⇒ BSON::ObjectId

Create a new object id from a string using ObjectId.from_string

Examples:

Create an object id from the string.

BSON::ObjectId(id)

Parameters:

  • string (String)

    The string to create the id from.

Returns:

Raises:

See Also:

Since:

  • 0.0.0



34
35
36
# File 'lib/bson.rb', line 34

def self.ObjectId(string)
  self::ObjectId.from_string(string)
end