Looking at this some more, I think this is a bug. A the very least an inconsistency between the way HexData and BinData work.
> db.bindata.insert({ foo: BinData(0,"gpJOnIbX+ZJkAwTZpAw=")})
> db.bindata.find()
{ "_id" : ObjectId("4e9d87aa5825b60b637815a6"), "foo" : null }
so BinData(0,"gpJOnIbX+ZJkAwTZpAw=")produces null..
> db.bindata.insert({ foo: HexData(0,"5555")})
> db.bindata.find()
{ "_id" : ObjectId("4e9d87aa5825b60b637815a6"), "foo" : null }
{ "_id" : ObjectId("4e9d87d15825b60b637815a7"), "foo" : BinData(0,"VVU=") }
whereas HexData(0, "5555") produces a non-null value, as expected.
If I use the new keyword with BinData, it does what I expect:
> db.bindata.insert({ foo: new BinData(0,"gpJOnIbX+ZJkAwTZpAw=")})
> db.bindata.find()
{ "_id" : ObjectId("4e9d87aa5825b60b637815a6"), "foo" : null }
{ "_id" : ObjectId("4e9d87d15825b60b637815a7"), "foo" : BinData(0,"VVU=") }
{ "_id" : ObjectId("4e9d87e15825b60b637815a8"), "foo" : BinData(0,"gpJOnIbX+ZJkAwTZpAw=") }
and..
> db.bindata.find({foo: new BinData(0,"gpJOnIbX+ZJkAwTZpAw=")})
{ "_id" : ObjectId("4e9d87e15825b60b637815a8"), "foo" : BinData(0,"gpJOnIbX+ZJkAwTZpAw=") }
so, basically "new" needed with BinData, but not HexData.