Reputation: 12322
Is there a way of using BSON() macro from the MongoDB C++ driver in order to generate a BSON will null value. For examples, in order to generate a BSON to represent this document: {"a": "foo", "b": null}
:
BSONObj myObj = BSON("a" << "foo" << "b" << <something that I don't know>);
I have tried with this (naïve) approach but it doesn't work:
BSONObj myObj = BSON("a" << "foo" << "b" << NULL);
Upvotes: 2
Views: 389
Reputation: 12727
I think you want to do:
BSONObj myObj = BSON("a" << "foo" << "b" << BSONNULL);
See this tutorial file for another example.
Upvotes: 2