How to create connection to MongoDB?
I can't create a connection to MongoDB, I do not know where to configure the connection.
https://docs.phalcon.io/en/latest/reference/odm.html Where do I put the code:
// Simple database connection to localhost
$di-> set ('mongo', function () {
$ mongo = new MongoClient ();
return $ mongo->selectDB("store");
}, True);
// Connecting to a domain socket, falling back to localhost connection
$ di->set('mongo', function () {
$ mongo = new MongoClient("mongodb:///tmp/mongodb-27017.sock,localhost:27017");
return $ mongo->selectDB("store");
}, True);
Could someone help?