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

w:0 on sharded write command is returning upserted values

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.5
    • Affects Version/s: 2.5.4
    • Component/s: None
    • Labels:
      None
    • ALL
    • Hide
      //
      // Start a shard
      var s = new ShardingTest("count1", 2, 1);
      var db = s.getDB("test");
      var collectionName = "batch_write_protocol";
      var coll = db.getCollection(collectionName);
      
      jsTest.log("Starting sharded write command tests...");
      
      var request;
      var result;
      
      //
      // Single document upsert, write concern 0 specified, ordered = true
      request = {update : collectionName, updates: [
      	{q:{a:2}, u: {$set: {a:2}}, upsert:true}
      ], writeConcern: {w:0}, ordered:true};
      result = coll.runCommand(request)
      jsTest.log(JSON.stringify(result, null, 2))
      return 
      assert.eq(1, result.ok);
      assert.eq(1, result.n);
      assert(result.upserted == null);
      
      Show
      // // Start a shard var s = new ShardingTest( "count1" , 2, 1); var db = s.getDB( "test" ); var collectionName = "batch_write_protocol" ; var coll = db.getCollection(collectionName); jsTest.log( "Starting sharded write command tests..." ); var request; var result; // // Single document upsert, write concern 0 specified, ordered = true request = {update : collectionName, updates: [ {q:{a:2}, u: {$set: {a:2}}, upsert: true } ], writeConcern: {w:0}, ordered: true }; result = coll.runCommand(request) jsTest.log(JSON.stringify(result, null , 2)) return assert .eq(1, result.ok); assert .eq(1, result.n); assert (result.upserted == null );

      When performing a write command with write concern w:0 it should not return either errDetails or upserts as w:0 indicates no information wanted and is meant to assure a fixed size return document to minimize wire transport size.

            Assignee:
            randolph@mongodb.com Randolph Tan
            Reporter:
            christkv Christian Amor Kvalheim
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: