diff options
author | Greg Studer <greg@10gen.com> | 2014-04-09 10:28:13 -0400 |
---|---|---|
committer | Greg Studer <greg@10gen.com> | 2014-04-11 17:01:15 -0400 |
commit | 4b589d8aab1675e03dc7efafc32239bda660fe96 (patch) | |
tree | 590369c2e90869427398acb1302c8e077178602f /src/mongo/s/cluster_write.cpp | |
parent | 225d63787821ddf35a5c04b7f22ed17da7042210 (diff) | |
download | mongo-4b589d8aab1675e03dc7efafc32239bda660fe96.tar.gz |
SERVER-13518 generate _ids in write batches if not set in mongos
Diffstat (limited to 'src/mongo/s/cluster_write.cpp')
-rw-r--r-- | src/mongo/s/cluster_write.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/s/cluster_write.cpp b/src/mongo/s/cluster_write.cpp index 8b2008f02b8..15cd83c2be0 100644 --- a/src/mongo/s/cluster_write.cpp +++ b/src/mongo/s/cluster_write.cpp @@ -315,9 +315,13 @@ namespace mongo { dassert( response->isValid(NULL) ); } - void ClusterWriter::write( const BatchedCommandRequest& request, + void ClusterWriter::write( const BatchedCommandRequest& origRequest, BatchedCommandResponse* response ) { + // Add _ids to insert request if req'd + auto_ptr<BatchedCommandRequest> idRequest(BatchedCommandRequest::cloneWithIds(origRequest)); + const BatchedCommandRequest& request = NULL != idRequest.get() ? *idRequest : origRequest; + const NamespaceString nss = NamespaceString( request.getNS() ); if ( !nss.isValid() ) { toBatchError( Status( ErrorCodes::InvalidNamespace, |