mongodb-php
MongoDB and CodeIgniter [closed]
I’m not sure if its the “CodeIgniter way” but I created a CodeIgniter library that extends the Mongo class with an extra property to store the current database connection. Here are the relevant code files from my project. config/mongo.php $config[‘mongo_server’] = null; $config[‘mongo_dbname’] = ‘mydb’; libraries/Mongo.php class CI_Mongo extends Mongo { var $db; function CI_Mongo() … Read more
Mongodb $push in nested array
Probably something like this where ID is your ObjectId. The first {} are necessary to identify your document. It is not required to use an ObjectId as long as you have another unique identifier in your collection. db.collection.update( { “_id”: ID, “playlists._id”: “58”}, { “$push”: {“playlists.$.musics”: { “name”: “test name”, “duration”: “4.00” } } } … Read more