protected byte[] GenerateBody()
        {
            //http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol#MongoWireProtocol-OPUPDATE
            //int32     ZERO;               // 0 - reserved for future use
            //cstring   fullCollectionName; // "dbname.collectionname"
            //int32 flags;                  // bit vector. see below
            //BSON selector;                // the query to select the document
            //BSON document;                // the document data to update with or insert

            var stream = new MemoryStream();
            //using (var stream = new MemoryStream())
            //{
            using (var writer = new BodyWriter(stream))
            {
                writer.Write(0);
                writer.Write(FullCollectionName);
                writer.WriteTerminator();
                writer.Write((int)Mode);// db.version() TODO: modify for version >2.6.
                writer.WriteSelector(QuerySelector ?? new object());
                writer.WriteDocument(Document);

                return stream.ToArray();
            }
            //}
        }
        protected byte[] GenerateBody()
        {
            //http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol#MongoWireProtocol-OPINSERT
            //int32     ZERO;               // 0 - reserved for future use
            //cstring   fullCollectionName; // "dbname.collectionname"
            //BSON[] documents;          // one or more documents to insert into the collection

            using(var stream = new MemoryStream())
            {
                using (var writer = new BodyWriter(stream))
                {
                    writer.Write(0);
                    writer.Write(FullCollectionName);
                    writer.WriteTerminator();

                    foreach (var document in Documents)
                        writer.WriteDocument(document);

                    return stream.ToArray();
                }
            }
        }