Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-850

Bulk WriteConcern half-ignored

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.2-rc0
    • Affects Version/s: 1.2-rc0
    • Component/s: None
    • None

      The following example will apply a getLastError command piggybacked into the bulk write with writeconcern=0.
      Any subsequent command will then result in wire protocol error:

      Invalid response_to. Expected 3, got 2.
      
         write_concern = mongoc_write_concern_new();                                       
         mongoc_write_concern_set_w (write_concern, 1);                                    
         mongoc_client_set_write_concern (client, write_concern);                          
                                                                                           
         str = gen_collection_name ("bulk_write_concern_over_1000");                       
         bulk = mongoc_bulk_operation_new (true);                                          
         mongoc_bulk_operation_set_database (bulk, "test");                                
         mongoc_bulk_operation_set_collection (bulk, str);                                 
         mongoc_write_concern_set_w (write_concern, 0);                                    
         mongoc_bulk_operation_set_write_concern (bulk, write_concern);                    
         mongoc_bulk_operation_set_client (bulk, client);                                  
                                                                                           
         for (i = 0; i < 1010; i+=3) {                                                     
            bson_init(&doc);                                                               
            bson_append_int32(&doc, "_id", -1, i);                                         
                                                                                           
            mongoc_bulk_operation_insert(bulk, &doc);                                      
                                                                                           
            bson_destroy(&doc);                                                            
         }                                                                                 
                                                                                           
         success = mongoc_bulk_operation_execute(bulk, NULL, &error);                                                                           
      

            Assignee:
            bjori Hannes Magnusson
            Reporter:
            bjori Hannes Magnusson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: