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/dbref.rb,
lib/bson/error.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/ext_json.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/db_pointer.rb,
lib/bson/decimal128.rb,
lib/bson/true_class.rb,
lib/bson/big_decimal.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/error/illegal_key.rb,
lib/bson/error/invalid_key.rb,
lib/bson/decimal128/builder.rb,
lib/bson/error/unsupported_type.rb,
lib/bson/error/bson_decode_error.rb,
lib/bson/error/invalid_object_id.rb,
lib/bson/error/invalid_binary_type.rb,
lib/bson/error/ext_json_parse_error.rb,
lib/bson/error/unserializable_class.rb,
lib/bson/error/invalid_dbref_argument.rb,
lib/bson/error/invalid_regexp_pattern.rb,
lib/bson/error/invalid_decimal128_range.rb,
lib/bson/error/invalid_decimal128_string.rb,
lib/bson/error/unrepresentable_precision.rb,
lib/bson/error/unsupported_binary_subtype.rb,
lib/bson/error/invalid_decimal128_argument.rb,
ext/bson/init.c

Overview

rubocop:todo all

Defined Under Namespace

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

Constant Summary collapse

BINARY =

Constant for binary string encoding.

Since:

  • 2.0.0

"BINARY"
NO_VALUE =

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

Since:

  • 2.0.0

::String.new(encoding: BINARY).freeze
NULL_BYTE =

Constant for a null byte (0x00).

Since:

  • 2.0.0

::String.new(0.chr, encoding: BINARY).freeze
UTF8 =

Constant for UTF-8 string encoding.

Since:

  • 2.0.0

"UTF-8"
DATE_REFERENCE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Julian day of Date 1970-01-01 - UNIX timestamp reference.

::Date.new(1970, 1, 1).jd
MILLISECONDS_IN_DAY =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Number of miliseconds in a day.

60 * 60 * 24 * 1_000
VERSION =
"5.0.2"

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



36
37
38
# File 'lib/bson.rb', line 36

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