BinData is binary data object that use in mongoDB. BinData consists of subType
and base64str
.
The BSON BinData datatype is represented via class BinData in the shell, each value represent specipic kind. like below :
example
Insert a BinData()
Object
Use the BinData()
constructor to create the bdata variable.
Insert the object into the testbin collection.
Query the testbin collection for the inserted document.
You can see the binary buffer stored in the collection.
Get the Length of BinData() Object
Use the BinData()
constructor to create the bdata variable.
Use .length()
to return the bit length of the object.
The returned value is:
reference