Mongo Funkcje
PHP Manual

mongo_insert

(PECL mongo >= 0.8.0)

mongo_insertInserts an array into a database collection

Opis

bool mongo_insert ( resource $connection , string $ns , array $query )

Inserts an array into a database collection.

Parametry

connection

The database connection to use.

ns

The database and collection name

obj

The array to insert.

Zwracane wartości

Whether the item was successfully inserted or not.

Przykłady

Przykład #1 mongo_insert() example

This example shows how to insert an array into a database collection.

<?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";
}

?>

Powyższy przykład wyświetli coś podobnego do:

inserted

Zobacz też:


Mongo Funkcje
PHP Manual