diff --git a/reference/mongo/configure.xml b/reference/mongo/configure.xml
index 3daea9b73c..3104ab62d1 100644
--- a/reference/mongo/configure.xml
+++ b/reference/mongo/configure.xml
@@ -9,7 +9,45 @@
&url.pecl.package;mongo.
-
+
+
+
+ Installing on *NIX
+
+
+
+
+ Manual Installation
+
+
+
+
+ OS X
+
+
+
+
+ Gentoo
+
+
+
+
+ Fedora
+
+
+
+
+ Installing on Windows
+
+
+
+
+ Third-Party Installation Instructions
+
+
+
+
+ Installing on *NIX
@@ -37,7 +75,7 @@ extension=mongo.so
-
+ Manual InstallationFor driver developers and people interested in the latest bugfixes, you
@@ -96,7 +134,7 @@ $ sudo make install
-
+ OS X
@@ -130,7 +168,7 @@ sudo /Applications/XAMPP/xamppfiles/bin/pecl install mongo
-
+ GentooOn Gentoo using PECL you might get an error that libtool is the wrong
version. Compiling from source you'll need to run aclocal and autoconf.
@@ -144,7 +182,7 @@ $ phpize && aclocal && autoconf && ./configure && make && make install
(Thanks to @riklaunim)
-
+ Fedora
If you don't want to modify php.ini directly, you can create a separate
@@ -162,7 +200,7 @@ extension=mongo.so
-
+ Installing on Windows
@@ -239,7 +277,7 @@ extension=php_mongo.dll
-
+ Third-Party Installation Instructions
diff --git a/reference/mongo/connecting.xml b/reference/mongo/connecting.xml
new file mode 100644
index 0000000000..5ecaaabe6e
--- /dev/null
+++ b/reference/mongo/connecting.xml
@@ -0,0 +1,73 @@
+
+
+
+
+ Connecting
+
+
+ Connecting to MongoDB can be as easy as new Mongo, but
+ there are many additional options and configurations. The
+ Mongo::__construct page covers all of the API options,
+ but this page gives some more practical use cases.
+
+
+
+ Logging In on Connection
+
+ If MongoDB is started with the --auth option, connections
+ must be authenticated before they are used. You can do this on a
+ per-database level with MongoDB::authenticate:
+
+
+admin;
+
+$db->authenticate($username, $password);
+
+?>
+]]>
+
+
+ There is a major disadvantage to this method: if the database connection is
+ dropped and then autoreconnects, the connection will no longer be
+ authenticated.
+
+
+ If you use the connection string format described by
+ Mongo::__construct, the database will authenticate the
+ connection as soon as it connects and reauthenticate if the connection is
+ re-esetablished.
+
+
+ This is equivalent to the code above, except that reconnections to the
+ database will automatically be authenticated:
+
+
+
+]]>
+
+
+ By default, the driver will authenticate the user against the admin database.
+ To authenticate with a different database, specify the database name after
+ the hosts. This example will log the user into the "blog" database:
+
+
+
+]]>
+
+
+
+
diff --git a/reference/mongo/examples.xml b/reference/mongo/examples.xml
deleted file mode 100644
index c8af7b1e85..0000000000
--- a/reference/mongo/examples.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-
-
- &reftitle.examples;
-
- This example shows how to connect,
- insert objects, query for objects, iterate through
- query results, and disconnect from a Mongo database.
-
-
- Mongo Example
-
-comedy;
-$collection = $db->cartoons;
-
-// add an element
-$obj = array( "title" => "Calvin and Hobbes", "author" => "Bill Watterson" );
-$collection->insert($obj);
-
-// add another element, with a different "shape"
-$obj = array( "title" => "XKCD", "online" => true );
-$collection->insert($obj);
-
-// find everything in the collection
-$cursor = $collection->find();
-
-// iterate through the results
-foreach ($cursor as $obj) {
- echo $obj["title"] . "\n";
-}
-
-// disconnect
-$m->close();
-
-?>
-]]>
-
- &example.outputs.similar;
-
-
-
-
-
-
-
-
diff --git a/reference/mongo/manual.xml b/reference/mongo/manual.xml
index 7646119eb3..b2986701c5 100644
--- a/reference/mongo/manual.xml
+++ b/reference/mongo/manual.xml
@@ -7,7 +7,7 @@
&reference.mongo.configure;
&reference.mongo.ini;
&reference.mongo.tutorial;
- &reference.mongo.examples;
+ &reference.mongo.connecting;
&reference.mongo.queries;
&reference.mongo.updates;
&reference.mongo.trouble;
diff --git a/reference/mongo/tutorial.xml b/reference/mongo/tutorial.xml
index 25da9c75b7..e4107fe7b8 100644
--- a/reference/mongo/tutorial.xml
+++ b/reference/mongo/tutorial.xml
@@ -401,4 +401,53 @@ $coll->ensureIndex( array( "i" => -1, "j" => 1 ) ); // index on "i" descending,
+
+ A Quick Example
+
+ This example connects, inserts objects, queries for objects, iterates through
+ query results, and disconnects from MongoDB.
+
+
+comedy;
+$collection = $db->cartoons;
+
+// add an element
+$obj = array( "title" => "Calvin and Hobbes", "author" => "Bill Watterson" );
+$collection->insert($obj);
+
+// add another element, with a different "shape"
+$obj = array( "title" => "XKCD", "online" => true );
+$collection->insert($obj);
+
+// find everything in the collection
+$cursor = $collection->find();
+
+// iterate through the results
+foreach ($cursor as $obj) {
+ echo $obj["title"] . "\n";
+}
+
+// disconnect
+$m->close();
+
+?>
+]]>
+
+
+ This would output:
+
+
+
+
+