MongoDB\BSON\Binary::fromVector
PHP function
Edit on GitHub ✎
(mongodb >=2.2.0)
Creates a new binary with subtype MongoDB\BSON\Binary::SUBTYPE_VECTOR from the given array and vector type
Description
MongoDB\BSON\Binary::fromVector(array $vector, MongoDB\BSON\VectorType $vectorType): MongoDB\BSON\Binary
Parameters
vector(array)An array of values representing the vector data. The type of each value must match the type indicated by the
vectorTypeparameter:- for
MongoDB\BSON\VectorType::Float32, each value must be afloat - for
MongoDB\BSON\VectorType::Int8, each value must be an 8-bitint, i.e. from-127to128 - for
MongoDB\BSON\VectorType::PackedBit, each value must be aboolor 1-bitint, i.e.0or1
- for
vectorType(MongoDB\BSON\VectorType)The vector data type.
Return Values
Returns a new Binary with subtype MongoDB\BSON\Binary::SUBTYPE_VECTOR.
Errors/Exceptions
See Also
MongoDB\BSON\Binary::toArrayMongoDB\BSON\Binary::getVectorTypeMongoDB\BSON\VectorType- BSON Types