@@ -747,31 +747,6 @@ namespace mongo {
747747
748748 void doneFast () { _b.doneFast (); }
749749
750- BSONArrayBuilder& append (const StringData& name, int n) {
751- fill ( name );
752- append ( n );
753- return *this ;
754- }
755-
756- BSONArrayBuilder& append (const StringData& name, long long n) {
757- fill ( name );
758- append ( n );
759- return *this ;
760- }
761-
762- BSONArrayBuilder& append (const StringData& name, double n) {
763- fill ( name );
764- append ( n );
765- return *this ;
766- }
767-
768- template <typename T>
769- BSONArrayBuilder& append (const StringData& name, const T& x) {
770- fill ( name );
771- append ( x );
772- return *this ;
773- }
774-
775750 template < class T >
776751 BSONArrayBuilder& append ( const std::list< T >& vals );
777752
@@ -782,57 +757,48 @@ namespace mongo {
782757 BufBuilder &subobjStart () { return _b.subobjStart ( num () ); }
783758 BufBuilder &subarrayStart () { return _b.subarrayStart ( num () ); }
784759
785- // These fill missing entries up to pos. if pos is < next pos is ignored
786- BufBuilder &subobjStart (int pos) {
787- fill (pos);
788- return _b.subobjStart ( num () );
789- }
790- BufBuilder &subarrayStart (int pos) {
791- fill (pos);
792- return _b.subarrayStart ( num () );
760+ BSONArrayBuilder& appendTimestamp (unsigned int sec, unsigned int inc) {
761+ _b.appendTimestamp (num (), sec, inc);
762+ return *this ;
793763 }
794764
795- // These should only be used where you really need interface compatibility with BSONObjBuilder
796- // Currently they are only used by update.cpp and it should probably stay that way
797- BufBuilder &subobjStart ( const StringData& name ) {
798- fill ( name );
799- return _b.subobjStart ( num () );
765+ BSONArrayBuilder& appendRegex (const StringData& regex, const StringData& options = " " ) {
766+ _b.appendRegex (num (), regex, options);
767+ return *this ;
800768 }
801769
802- BufBuilder & subarrayStart ( const StringData& name ) {
803- fill ( name );
804- return _b. subarrayStart ( num () ) ;
770+ BSONArrayBuilder& appendBinData ( int len, BinDataType type, const void * data ) {
771+ _b. appendBinData ( num (), len, type, data );
772+ return * this ;
805773 }
806774
807- BSONArrayBuilder& appendArray ( const StringData& name, const BSONObj& subObj ) {
808- fill ( name );
809- _b.appendArray ( num (), subObj );
775+ BSONArrayBuilder& appendCode (const StringData& code) {
776+ _b.appendCode (num (), code);
810777 return *this ;
811778 }
812779
813- BSONArrayBuilder& appendAs ( const BSONElement &e, const StringData& name) {
814- fill ( name );
815- append ( e );
780+ BSONArrayBuilder& appendCodeWScope (const StringData& code, const BSONObj& scope) {
781+ _b.appendCodeWScope (num (), code, scope);
816782 return *this ;
817783 }
818784
819- BSONArrayBuilder& appendTimestamp ( unsigned int sec, unsigned int inc ) {
820- _b.appendTimestamp (num (), sec, inc );
785+ BSONArrayBuilder& appendTimeT ( time_t dt ) {
786+ _b.appendTimeT (num (), dt );
821787 return *this ;
822788 }
823789
824- BSONArrayBuilder& appendRegex ( const StringData& regex, const StringData& options = " " ) {
825- _b.appendRegex (num (), regex, options );
790+ BSONArrayBuilder& appendDate (Date_t dt ) {
791+ _b.appendDate (num (), dt );
826792 return *this ;
827793 }
828794
829- BSONArrayBuilder& appendTimestamp ( unsigned long long ts ) {
830- _b.appendTimestamp (num (), ts );
795+ BSONArrayBuilder& appendBool ( bool val ) {
796+ _b.appendBool (num (), val );
831797 return *this ;
832798 }
833799
834- BSONArrayBuilder& append ( const StringData& s ) {
835- _b.append (num (), s );
800+ BSONArrayBuilder& appendTimestamp ( unsigned long long ts ) {
801+ _b.appendTimestamp (num (), ts );
836802 return *this ;
837803 }
838804
@@ -846,29 +812,6 @@ namespace mongo {
846812 BufBuilder& bb () { return _b.bb (); }
847813
848814 private:
849- // These two are undefined privates to prevent their accidental
850- // use as we don't support unsigned ints in BSON
851- BSONObjBuilder& append (const StringData& fieldName, unsigned int val);
852- BSONObjBuilder& append (const StringData& fieldName, unsigned long long val);
853-
854- void fill ( const StringData& name ) {
855- long int n;
856- Status status = parseNumberFromStringWithBase ( name, 10 , &n );
857- uassert ( 13048 ,
858- (std::string)" can't append to array using string field name: " + name.toString (),
859- status.isOK () );
860- fill (n);
861- }
862-
863- void fill (int upTo){
864- // if this is changed make sure to update error message and jstests/set7.js
865- const int maxElems = 1500000 ;
866- BOOST_STATIC_ASSERT (maxElems < (BSONObjMaxUserSize/10 ));
867- uassert (15891 , " can't backfill array to larger than 1,500,000 elements" , upTo <= maxElems);
868-
869- while ( _i < upTo )
870- appendNull ();
871- }
872815
873816 std::string num () { return _b.numStr (_i++); }
874817 int _i;
0 commit comments