@@ -79,44 +79,44 @@ public function listDatabases()
7979 }
8080
8181 /**
82- * Select a database .
82+ * Select a collection .
8383 *
8484 * If a write concern or read preference is not specified, the write concern
8585 * or read preference of the Client will be applied, respectively.
8686 *
87- * @param string $databaseName Name of the database to select
87+ * @param string $databaseName Name of the database containing the collection
88+ * @param string $collectionName Name of the collection to select
8889 * @param WriteConcern $writeConcern Default write concern to apply
8990 * @param ReadPreference $readPreference Default read preference to apply
90- * @return Database
91+ * @return Collection
9192 */
92- public function selectDatabase ($ databaseName , WriteConcern $ writeConcern = null , ReadPreference $ readPreference = null )
93+ public function selectCollection ($ databaseName, $ collectionName , WriteConcern $ writeConcern = null , ReadPreference $ readPreference = null )
9394 {
95+ $ namespace = $ databaseName . '. ' . $ collectionName ;
9496 // TODO: inherit from Manager options once PHPC-196 is implemented
9597 $ writeConcern = $ writeConcern ?: $ this ->writeConcern ;
9698 $ readPreference = $ readPreference ?: $ this ->readPreference ;
9799
98- return new Database ($ this ->manager , $ databaseName , $ writeConcern , $ readPreference );
100+ return new Collection ($ this ->manager , $ namespace , $ writeConcern , $ readPreference );
99101 }
100102
101103 /**
102- * Select a collection .
104+ * Select a database .
103105 *
104106 * If a write concern or read preference is not specified, the write concern
105107 * or read preference of the Client will be applied, respectively.
106108 *
107- * @param string $databaseName Name of the database containing the collection
108- * @param string $collectionName Name of the collection to select
109+ * @param string $databaseName Name of the database to select
109110 * @param WriteConcern $writeConcern Default write concern to apply
110111 * @param ReadPreference $readPreference Default read preference to apply
111- * @return Collection
112+ * @return Database
112113 */
113- public function selectCollection ($ databaseName, $ collectionName , WriteConcern $ writeConcern = null , ReadPreference $ readPreference = null )
114+ public function selectDatabase ($ databaseName , WriteConcern $ writeConcern = null , ReadPreference $ readPreference = null )
114115 {
115- $ namespace = $ databaseName . '. ' . $ collectionName ;
116116 // TODO: inherit from Manager options once PHPC-196 is implemented
117117 $ writeConcern = $ writeConcern ?: $ this ->writeConcern ;
118118 $ readPreference = $ readPreference ?: $ this ->readPreference ;
119119
120- return new Collection ($ this ->manager , $ namespace , $ writeConcern , $ readPreference );
120+ return new Database ($ this ->manager , $ databaseName , $ writeConcern , $ readPreference );
121121 }
122122}
0 commit comments