Mongo::Commands::Common::Upserted
Inherits BSON::Serializable / Struct / Value / Object
Upserted bson sub-document.
Constructors
new(index : Int32, _id : BSON | BSON::Code | BSON::DBPointer | BSON::Decimal128 | BSON::MaxKey | BSON::MinKey | BSON::ObjectId | BSON::Symbol | BSON::Timestamp | BSON::Undefined | Bool | Float64 | Int32 | Int64 | Regex | Slice(UInt8) | String | Time | UUID | Nil)
Sourcenew(bson : BSON)
Allocate an instance and copies data from a BSON struct.
class User
include BSON::Serializable
property name : String
end
data = BSON.new
data["name"] = "John"
User.new(data)
Class methods
from_bson(bson : BSON)
NOTE: See self.new.
Instance methods
_id
Source_id=(_id : BSON::Value)
Sourceindex
Sourceto_bson(bson = BSON.new)
Converts to a BSON representation.
user = User.new name: "John"
bson = user.to_bson