CSMongo.Requests.InsertRequest.GenerateBody C# (CSharp) Method

GenerateBody() protected method

Prepares the body of the request to send to the server
protected GenerateBody ( DynamicStream stream ) : void
stream CSMongo.IO.DynamicStream
return void
        protected override void GenerateBody(DynamicStream stream)
        {
            //required ZERO int after header
            stream.Append(BsonTranslator.AsInt32(0));

            //apply the collection and database
            stream.Append(BsonTranslator.AsString(this.GetDatabaseTarget()));

            //and generate each of the documents
            foreach (MongoDocument document in this.Documents) {
                stream.Append(document.ToBsonByteArray());
            }
        }