BSON type classes and serialization functionsTable of Contents
The MongoDB\BSON\Binary classIntroduction
Class synopsisMongoDB\BSON\Binary
class MongoDB\BSON\Binary
implements
MongoDB\BSON\Type
,
Serializable
,
JsonSerializable
{
/* Constants */
const
integer
MongoDB\BSON\Binary::TYPE_GENERIC
= 0
;
const
integer
MongoDB\BSON\Binary::TYPE_FUNCTION
= 1
;
const
integer
MongoDB\BSON\Binary::TYPE_OLD_BINARY
= 2
;
const
integer
MongoDB\BSON\Binary::TYPE_OLD_UUID
= 3
;
const
integer
MongoDB\BSON\Binary::TYPE_UUID
= 4
;
const
integer
MongoDB\BSON\Binary::TYPE_MD5
= 5
;
const
integer
MongoDB\BSON\Binary::TYPE_USER_DEFINED
= 128
;
/* Methods */
final public __construct
( string
$data
, integer $type
)
final public string getData
( void
)
final public integer getType
( void
)
final public mixed jsonSerialize
( void
)
final public string serialize
( void
)
final public string __toString
( void
)
final public void unserialize
( string
}$serialized
)Predefined Constants
Changelog
The MongoDB\BSON\Decimal128 classIntroductionBSON type for the » Decimal128 floating-point format, which supports numbers with up to 34 decimal digits (i.e. significant digits) and an exponent range of −6143 to +6144. Unlike the double BSON type (i.e. float in PHP), which only stores an approximation of the decimal values, the decimal data type stores the exact value. For example, MongoDB\BSON\Decimal128('9.99') has a precise value of 9.99 where as a double 9.99 would have an approximate value of 9.9900000000000002131628….
Class synopsisMongoDB\BSON\Decimal128
class MongoDB\BSON\Decimal128
implements
MongoDB\BSON\Type
,
Serializable
,
JsonSerializable
{
/* Methods */
final public __construct
([ string
$value
] )
final public mixed jsonSerialize
( void
)
final public string serialize
( void
)
final public string __toString
( void
)
final public void unserialize
( string
}$serialized
)Changelog
The MongoDB\BSON\Javascript classIntroduction
Class synopsisMongoDB\BSON\Javascript
class MongoDB\BSON\Javascript
implements
MongoDB\BSON\Type
,
Serializable
,
JsonSerializable
{
/* Methods */
final public __construct
( string
$code
[, array|object $scope
] )
final public string getCode
( void
)
final public object|null getScope
( void
)
final public mixed jsonSerialize
( void
)
final public string serialize
( void
)
final public string __toString
( void
)
final public void unserialize
( string
}$serialized
)Changelog
The MongoDB\BSON\MaxKey classIntroduction
Class synopsisMongoDB\BSON\MaxKey
class MongoDB\BSON\MaxKey
implements
MongoDB\BSON\Type
,
Serializable
,
JsonSerializable
{
/* Methods */
final public __construct
( void
)
final public mixed jsonSerialize
( void
)
final public string serialize
( void
)
final public void unserialize
( string
}$serialized
)Changelog
The MongoDB\BSON\MinKey classIntroduction
Class synopsisMongoDB\BSON\MinKey
class MongoDB\BSON\MinKey
implements
MongoDB\BSON\Type
,
Serializable
,
JsonSerializable
{
/* Methods */
final public __construct
( void
)
final public mixed jsonSerialize
( void
)
final public string serialize
( void
)
final public void unserialize
( string
}$serialized
)Changelog
The MongoDB\BSON\ObjectID classIntroduction
Class synopsisMongoDB\BSON\ObjectID
class MongoDB\BSON\ObjectID
implements
MongoDB\BSON\Type
,
Serializable
,
JsonSerializable
{
/* Methods */
final public __construct
([ string
$id
] )
final public integer getTimestamp
( void
)
final public mixed jsonSerialize
( void
)
final public string serialize
( void
)
final public string __toString
( void
)
final public void unserialize
( string
}$serialized
)Changelog
The MongoDB\BSON\Regex classIntroduction
Class synopsisMongoDB\BSON\Regex
class MongoDB\BSON\Regex
implements
MongoDB\BSON\Type
,
Serializable
,
JsonSerializable
{
/* Methods */
final public __construct
( string
$pattern
[, string $flags = ""
] )
final public string getFlags
( void
)
final public string getPattern
( void
)
final public mixed jsonSerialize
( void
)
final public string serialize
( void
)
final public string __toString
( void
)
final public void unserialize
( string
}$serialized
)Changelog
The MongoDB\BSON\Timestamp classIntroductionRepresents a » BSON timestamp, which is an internal MongoDB type not intended for general date storage. Class synopsisMongoDB\BSON\Timestamp
class MongoDB\BSON\Timestamp
implements
MongoDB\BSON\Type
,
Serializable
,
JsonSerializable
{
/* Methods */
final public __construct
( integer
$increment
, integer $timestamp
)
final public mixed jsonSerialize
( void
)
final public string serialize
( void
)
final public string __toString
( void
)
final public void unserialize
( string
}$serialized
)Changelog
The MongoDB\BSON\UTCDateTime classIntroductionRepresents a » BSON date. Class synopsisMongoDB\BSON\UTCDateTime
class MongoDB\BSON\UTCDateTime
implements
MongoDB\BSON\Type
,
Serializable
,
JsonSerializable
{
/* Methods */
final public __construct
([ integer|float|string|DateTimeInterface
$milliseconds = NULL
] )
final public mixed jsonSerialize
( void
)
final public string serialize
( void
)
final public DateTime toDateTime
( void
)
final public string __toString
( void
)
final public void unserialize
( string
}$serialized
)Changelog
The MongoDB\BSON\Type interfaceIntroduction
Class synopsisMongoDB\BSON\Type
class MongoDB\BSON\Type
{
}The MongoDB\BSON\Persistable interfaceIntroductionClasses may implement this interface to take advantage of automatic ODM (object document mapping) behavior in the driver. During serialization, the driver will inject a __pclass property containing the PHP class name into the data returned by MongoDB\BSON\Serializable::bsonSerialize. During unserialization, the same __pclass property will then be used to infer the PHP class (independent of any type map configuration) to be constructed before MongoDB\BSON\Unserializable::bsonUnserialize is invoked. See Persisting Data for additional information.
Class synopsisMongoDB\BSON\Persistable
class MongoDB\BSON\Persistable
implements
MongoDB\BSON\Unserializable
,
MongoDB\BSON\Serializable
{
/* Inherited methods */
abstract public array|object MongoDB\BSON\Serializable::bsonSerialize
( void
)
abstract public void MongoDB\BSON\Unserializable::bsonUnserialize
( array
}$data
)The MongoDB\BSON\Serializable interfaceIntroductionClasses that implement this interface may return data to be serialized as a BSON array or document in lieu of the object's public properties. Class synopsisMongoDB\BSON\Serializable
class MongoDB\BSON\Serializable
implements
MongoDB\BSON\Type
{
/* Methods */
abstract public array|object bsonSerialize
( void
)
}The MongoDB\BSON\Unserializable interfaceIntroductionClasses that implement this interface may be specified in a type map for unserializing BSON arrays and documents (both root and embedded). Class synopsisMongoDB\BSON\Unserializable
class MongoDB\BSON\Unserializable
{
/* Methods */
abstract public void bsonUnserialize
( array
}$data
) |