mongodb-php

MongoDB and CodeIgniter

Can anyone assist in pointing me to a tutorial, library, etc. that will allow me to work with MongoDB from CodeIgniter? Any help is really appreciated. ...

Mongo Map Reduce first time

Hello guys, First time Map/Reduce user here, and using MongoDB. I have a lot of page visit data which I'd like to make some sense of by using Map/Reduce. Below is basically what I want to do, but as a total beginner a Map/Reduce, I think this is above my knowledge! Go through all the pages with visits in the last 30 days, and where ex...

Handling sessions without ACID database?

Hi everybody, I am thinking about using a noSQL (mongoDB) paired with memcached to store sessions with in my webapp. The idea is that upon each page load, the user data is compared to the data in the memcache and if something has changed, the data would be written to both memcached and mySQL. This way the reads would be greatly reduced ...

php mongodb : Call to undefined method MongoDB::insert() in db.php

I'm running this code: $db = new Mongo("mongodb://user:[email protected]:27081/dbname"); $collection = $db->foobar; $collection->insert($content); I'm trying to test mongohq by just creating a random collection. I'm getting this error: Fatal error: Call to undefined method MongoDB::insert() in /ajax/db.php on line 2...

Can't access values in MongoDB with cursor using PHP

I seem to be having some trouble using the cursor as I try to pull data out of a MongoDB. Here is a screenshot of my simple data structure: I'm trying to use the following: $collection_name = "users"; $collection = $this->mongo->db->$collection_name; $which_document = array("email" => $email_address); $which_fields = array("words"); ...

mongodb php - how to do "INNER JOIN"-like query

I'm using the Mongo PHP extension. My data looks like: users { "_id": "4ca30369fd0e910ecc000006", "login": "user11", "pass": "example_pass", "date": "2010-09-29" }, { "_id": "4ca30373fd0e910ecc000007", "login": "user22", "pass": "example_pass", "date": "2010-09-29" } news { "_id": "4ca305c2fd0e910ecc000003", "name"...

Creating indexes on new collections in MongoDB + PHP

We use MongoDB to collect logs on pageviews. $collection_name = "logs.".date('Y').".".date('m').".".date('d'); $collection = $this->Mongo->$collection_name; $collection->insert($pageview); The code above creates a new collection for every day. I would like to be able to create an index on the above collection when it is created. Is...

Calling stored JavaScript function in MongoDB from PHP

I have this function stored in db.system.js function SomeFunc(o) { x = db.Collection; while( 1 ) { var c = x.find({},{_id:1}).sort({_id:-1}).limit(1); var i = c.hasNext() ? c.next()._id + 1 : 1; o._id = i; x.insert(o); var err = db.getLastErrorObj(); if( err && err.code ) { ...

Best practice for updating a MongoDB collection with unknown modified fields.

Hey guys, So I'm building an app using PHP and MongoDB which will have a fair bit of traffic in both reads and writes.. After a couple of months there should be around 2500 reads a second and 200 writes per second (not sure how that really rates in terms of traffic compared to others, though). I'm a bit curious on what to do when upda...