BSONArrayBuilder builder; builder.append(1); builder.append(2); builder.append(3); BSONArray array = builder.arr(); // Output: [1, 2, 3]
BSONArrayBuilder builder; builder.append("hello"); builder.append("world"); BSONArray array = builder.arr(); // Output: ["hello", "world"]These examples are using the BSON library. The package library is most likely "mongo-cxx-driver".