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

MapReduce to empty capped collection results in NON-capped collection

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.3
    • Affects Version/s: 2.4.10, 2.6.0
    • Component/s: MapReduce
    • None
    • Minor Change
    • ALL
    • Hide

      db.input.drop()
      db.cap.drop()
      db.input.insert(

      {foo:"bar"}

      )
      var map = function() {
      var key = this._id;
      var value = 1;
      emit(key, value );
      }
      var reduce = function(key, values) {
      return Array.sum(values);
      }

      db.createCollection("cap",

      {capped:true,size:100000}

      )
      db.cap.stats() // Collection is capped
      db.input.mapReduce(map,reduce,{out:{reduce:"cap"}})
      db.cap.stats() // Collection is not capped

      //M/R to non empty capped collection
      db.cap.drop()
      db.createCollection("cap",

      {capped:true,size:100000}

      )
      db.cap.insert(

      {dummy:true}

      )
      db.cap.stats() // Collection is capped
      db.input.mapReduce(map,reduce,{out:{reduce:"cap"}})
      db.cap.stats() // Collection is capped

      Show
      db.input.drop() db.cap.drop() db.input.insert( {foo:"bar"} ) var map = function() { var key = this._id; var value = 1; emit(key, value ); } var reduce = function(key, values) { return Array.sum(values); } db.createCollection("cap", {capped:true,size:100000} ) db.cap.stats() // Collection is capped db.input.mapReduce(map,reduce,{out:{reduce:"cap"}}) db.cap.stats() // Collection is not capped //M/R to non empty capped collection db.cap.drop() db.createCollection("cap", {capped:true,size:100000} ) db.cap.insert( {dummy:true} ) db.cap.stats() // Collection is capped db.input.mapReduce(map,reduce,{out:{reduce:"cap"}}) db.cap.stats() // Collection is capped
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      When doing a map reduce where the out collection is an empty capped collection and the out method of reduce, the result is a non-capped collection.
      If the out is a non empty capped collection, then it remain capped.

            Assignee:
            dan@mongodb.com Daniel Pasette (Inactive)
            Reporter:
            levyavi Avi Levy
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: