They have a len() method and, at the beginning, I based the implementation on that. However, after some strange behavior detected with the debugger, the len() function doesn't behaves as I expected so I decided to keep track myself using to int counters.

(BTW, the documentation at http://api.mongodb.org/cplusplus/2.2.3/classmongo_1_1_b_s_o_n_array_builder.html is very funny :). Does it refer to the number of elements in the array? To the len of the BSON document in bytes? It isn't clear).

NTC