Connecting To NoSQL

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsConnecting To NoSQL
Line 13: Line 13:
 
* Credentials can be part of the connection string or included in the Options section. See [http://php.net/manual/en/mongoclient.construct.php here] for available options.   
 
* Credentials can be part of the connection string or included in the Options section. See [http://php.net/manual/en/mongoclient.construct.php here] for available options.   
 
* Click Create Service to save your new service.   
 
* Click Create Service to save your new service.   
* Go to the API Docs tab in the admin console to test your new service
+
* Go to the API Docs tab in the admin console to test your new service
 
<br />
 
<br />
 
'''NOTE''' In order to create a new MongoDB service you must have the PHP driver installed on your system.  Otherwise the admin console will report an error when you try to create the service. Below are the steps to install MongoDB drivers for PHP on Ubuntu Linux. After these steps you'll be able to create your new MongoDB service.  For OS X or Windows we recommend using the Bitnami installer, which already has the MongoDB driver installed.   
 
'''NOTE''' In order to create a new MongoDB service you must have the PHP driver installed on your system.  Otherwise the admin console will report an error when you try to create the service. Below are the steps to install MongoDB drivers for PHP on Ubuntu Linux. After these steps you'll be able to create your new MongoDB service.  For OS X or Windows we recommend using the Bitnami installer, which already has the MongoDB driver installed.   
 
<br />
 
<br />
'''Installing the MongpoDB driver for PHP on Ubuntu'''   
+
'''Installing the MongoDB driver for PHP on Ubuntu'''   
 
<br />
 
<br />
 
<pre>
 
<pre>

Revision as of 23:35, 6 November 2015

MongoDB

Bitnami DreamFactory installs come with MongoDB already installed and configured as a DreamFactory service. This includes a MongoDB server plus the drivers to connect to it. You can connect to this pre-configured service without any additional setup.

If you want to connect to some other MongoDB server you must add a new MongoDB service using the following steps.

  • Go to the Services tab in the admin console.
  • Click Create.
  • Set the Service Type to MongoDB.
  • Enter a name and label for the service. Name will be part of the URL for accessing the service via the REST API.
  • Go to the Config tab for the new service.
  • Enter the connection string for the MongoDB server you want to connect to.
  • Credentials can be part of the connection string or included in the Options section. See here for available options.
  • Click Create Service to save your new service.
  • Go to the API Docs tab in the admin console to test your new service


NOTE In order to create a new MongoDB service you must have the PHP driver installed on your system. Otherwise the admin console will report an error when you try to create the service. Below are the steps to install MongoDB drivers for PHP on Ubuntu Linux. After these steps you'll be able to create your new MongoDB service. For OS X or Windows we recommend using the Bitnami installer, which already has the MongoDB driver installed.
Installing the MongoDB driver for PHP on Ubuntu

sudo apt-get install php5-dev php5-cli php-pear
sudo pecl install mongo  
sudo vi /etc/php5/apache2/php.ini  (search for 'extension=' and add 'extension=mongo.so' to this section of file, then save file)
sudo service apache2 restart