note 97664 added to class.mongodb
| From: | jonwage at gmail dot com | Date: | Sat, 01 May 2010 18:56:56 +0000 |
| Subject: | note 97664 added to class.mongodb | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168842@lists.php.net to get a copy of this message | ||
Just a note that if you use selectDB() and only select it, the database will not be created. In
PHPMongoDBAdmin(http://github.com/jwage/php-mongodb-admin) I wanted a way to create a database
through a form so I needed to create a dummy collection and drop it in order for the database to be
created. MongoDB has a drop() method but no create() method.
<?php
$mongo->selectDB('db')->createCollection('__tmp_collection_');
$mongo->selectDB('db')->dropCollection('__tmp_collection_');
?>
Any better way to do this?
----
Server IP: 64.71.164.2
Probable Submitter: 71.56.27.132
----
Manual Page -- http://www.php.net/manual/en/class.mongodb.php
Edit -- https://master.php.net/note/edit/97664
Del: integrated -- https://master.php.net/note/delete/97664/integrated
Del: useless -- https://master.php.net/note/delete/97664/useless
Del: bad code -- https://master.php.net/note/delete/97664/bad+code
Del: spam -- https://master.php.net/note/delete/97664/spam
Del: non-english -- https://master.php.net/note/delete/97664/non-english
Del: in docs -- https://master.php.net/note/delete/97664/in+docs
Del: other reasons-- https://master.php.net/note/delete/97664
Reject -- https://master.php.net/note/reject/97664
Search -- https://master.php.net/manage/user-notes.php