1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-24 07:42:10 +01:00
Files
archived-doc-en/reference/mongodb/bson/binary/fromvector.xml
Andreas Braun dac7a370d3 Document new API in ext-mongodb 2.2.0 (#5370)
* Document new API in ext-mongodb 2.2.0

* Apply suggestions from code review

Co-authored-by: Jeremy Mikola <jmikola@gmail.com>

---------

Co-authored-by: Jeremy Mikola <jmikola@gmail.com>
2026-02-13 08:19:35 +01:00

92 lines
3.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mongodb-bson-binary.fromvector" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoDB\BSON\Binary::fromVector</refname>
<refpurpose>Creates a new binary with subtype <constant>MongoDB\BSON\Binary::SUBTYPE_VECTOR</constant> from the given array and vector type</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>final</modifier> <modifier>public</modifier> <modifier>static</modifier> <type>MongoDB\BSON\Binary</type><methodname>MongoDB\BSON\Binary::fromVector</methodname>
<methodparam><type>array</type><parameter>vector</parameter></methodparam>
<methodparam><type>MongoDB\BSON\VectorType</type><parameter>vectorType</parameter></methodparam>
</methodsynopsis>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>vector</parameter> (<type>array</type>)</term>
<listitem>
<para>
An array of values representing the vector data. The type of each value must match the type indicated by the <parameter>vectorType</parameter> parameter:
<itemizedlist>
<listitem><simpara>for <constant>MongoDB\BSON\VectorType::Float32</constant>, each value must be a <type>float</type></simpara></listitem>
<listitem><simpara>for <constant>MongoDB\BSON\VectorType::Int8</constant>, each value must be an 8-bit <type>int</type>, i.e. from <literal>-127</literal> to <literal>128</literal></simpara></listitem>
<listitem><simpara>for <constant>MongoDB\BSON\VectorType::PackedBit</constant>, each value must be a <type>bool</type> or 1-bit <type>int</type>, i.e. <literal>0</literal> or <literal>1</literal></simpara></listitem>
</itemizedlist>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>vectorType</parameter> (<type>MongoDB\BSON\VectorType</type>)</term>
<listitem>
<para>
The vector data type.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a new Binary with subtype <constant>MongoDB\BSON\Binary::SUBTYPE_VECTOR</constant>.
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<simplelist>
&mongodb.throws.argumentparsing;
</simplelist>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>MongoDB\BSON\Binary::toArray</methodname></member>
<member><methodname>MongoDB\BSON\Binary::getVectorType</methodname></member>
<member><enumname>MongoDB\BSON\VectorType</enumname></member>
<member><link xlink:href="&url.mongodb.docs.bson;">BSON Types</link></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->