0

I am using mongodb in codeigniter.

collections

'mtb'
'road'
'minivelo'

php

$map = new MongoCode('
    function(){
        ....
    }
');
$reduce = new MongoCode('
    function(key, values){
                 ....
    }
');
$result = $this->mongo_db->command(array(
    'mapreduce'=>$in, // <= 'mtb' 'road' 'minivelo'
    'map'=>$map,
    'reduce'=>$reduce,
    'query'=>array(...)),
    'out'=>'statistics'
));

How could I get MapReduce result from several collections?

soredive
  • 795
  • 1
  • 9
  • 25

1 Answers1

1

you can only get results from several collections with several queries. mongodb = no joins.

see this answer: MongoDB map/reduce over multiple collections?

Community
  • 1
  • 1
Toby
  • 2,720
  • 5
  • 29
  • 46