Method: BSON::Timestamp#as_extended_json

Defined in:
lib/bson/timestamp.rb

#as_extended_json(**options) ⇒ Hash

Converts this object to a representation directly serializable to Extended JSON (github.com/mongodb/specifications/blob/master/source/extended-json/extended-json.md).

Parameters:

  • opts (Hash)

    a customizable set of options

Returns:

  • (Hash)

    The extended json representation.

Since:

  • 2.0.0



101
102
103
# File 'lib/bson/timestamp.rb', line 101

def as_extended_json(**options)
  { "$timestamp" => { "t" => seconds, "i" => increment } }
end