Skip to content

Commit

Permalink
CSHARP-715: InsertBatch fails when large batch has to be split into s…
Browse files Browse the repository at this point in the history
…maller sub batches.
  • Loading branch information
rstam committed Mar 27, 2013
1 parent 072aad4 commit 7e7b57a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions MongoDB.Driver/Communication/Messages/MongoInsertMessage.cs
Expand Up @@ -60,6 +60,7 @@ internal byte[] RemoveLastDocument(BsonBuffer buffer)
var lastDocumentLength = buffer.Position - _lastDocumentStartPosition;
buffer.Position = _lastDocumentStartPosition;
var lastDocument = buffer.ReadBytes(lastDocumentLength);
buffer.Position = _lastDocumentStartPosition;
buffer.Length = _lastDocumentStartPosition;
BackpatchMessageLength(buffer);
return lastDocument;
Expand All @@ -68,6 +69,7 @@ internal byte[] RemoveLastDocument(BsonBuffer buffer)
internal void ResetBatch(BsonBuffer buffer, byte[] lastDocument)
{
buffer.Position = _firstDocumentStartPosition;
buffer.Length = _firstDocumentStartPosition;
buffer.WriteBytes(lastDocument);
BackpatchMessageLength(buffer);
}
Expand Down

0 comments on commit 7e7b57a

Please sign in to comment.