protected byte[] GenerateBody()
        {
            //http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol#MongoWireProtocol-OPDELETE
            //int32     ZERO;                   // 0 - reserved for future use
            //cstring   fullCollectionName;     // "dbname.collectionname"
            //int32     ZERO;                   // 0 - reserved for future use
            //BSON      selector;               // BSON document that represent the query used
            // to select the documents to be removed. The
            // selector will contain one or more elements,
            // all of which must match for a document to be
            //removed from the collection
            //using (var stream = new MemoryStream())
            var stream = new MemoryStream();
            //{
            using (var writer = new BodyWriter(stream))
            {
                writer.Write(0);
                writer.Write(FullCollectionName);
                writer.Write(0);
                writer.WriteTerminator();
                writer.WriteSelector(Selector ?? new object());

                return stream.ToArray();
            }
            //}
        }
        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();
                }
            }
        }