mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-26 05:48:57 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@276456 c90b9560-bf6c-de11-be94-00142212c4b1
128 lines
2.9 KiB
XML
128 lines
2.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision: 1.3 $ -->
|
|
|
|
<refentry xml:id="function.mongo-insert" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>mongo_insert</refname>
|
|
<refpurpose>Inserts an array into a database collection</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>mongo_insert</methodname>
|
|
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>ns</parameter></methodparam>
|
|
<methodparam><type>array</type><parameter>query</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Inserts an array into a database collection.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>connection</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The database connection to use.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>ns</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The database and collection name
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>obj</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The array to insert.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Whether the item was successfully inserted or not.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>mongo_insert</function> example</title>
|
|
<para>
|
|
This example shows how to insert an array into a database collection.
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$obj = array("x" => "y", "z" => 2.4);
|
|
$conn = mongo_connect("localhost", true);
|
|
if (!$conn) {
|
|
die("Could not connect.");
|
|
}
|
|
$ok = mongo_insert($conn, "foo.bar", $obj);
|
|
if( $ok ) {
|
|
echo "inserted";
|
|
}
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
inserted
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>mongo_update</function></member>
|
|
<member><function>mongo_remove</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</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:"../../../../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
|
|
-->
|