Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-636

MapReduce in PHP crashes server

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major - P3 Major - P3
    • None
    • 1.3.2
    • JavaScript
    • None
    • db version: 1.3.2- PHP 5.2.9 - mongodb-linux-x86_64-v8-2010-02-14; Linux linux-bkk.geoadmin.com 2.6.27.5-117.fc10.x86_64

    Description

      Following PHP script will crash mongod

      $connection = new Mongo(); // connects to localhost:27017
      $game = $connection->test->game;
      $start = new MongoDate(strtotime("2009-12-01 00:00:00"));
      $end = new MongoDate(strtotime("2010-01-01 00:00:00"));
      $game_id = 'wxxz0xu4hdcm7ob4ps47rf89';

      $map = new MongoCode("function() { emit(this.g_id,

      {c: 2, d: this}

      ); }");
      $reduce = new MongoCode('function(k, vals) {
      var sum = 0;
      for (var i in vals)

      { sum += 1; }

      return sum;
      }
      ');

      $where = array("dt" => array('$gt' => $start, '$lte' => $end));

      $sales = $connection->casino->command(array(
      "mapreduce" => "game",
      "map" => $map,
      "reduce" => $reduce,
      "query" => $where
      ));

      $cursor = $connection->casino->selectCollection($sales['result'])>find()>limit(-100);
      foreach ($cursor as $obj){
      print_r($obj);
      }

      Attachments

        Activity

          People

            eliot Eliot Horowitz (Inactive)
            vladaman Vladimir Vlach
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: