MongoDB shell将二进制数据打印为Base64编码的字符串,该字符串封装在一个函数调用中:
"_id" : BinData(0,"e8MEnzZoFyMmD7WSHdNrFJyEk8M=")
"0"是什么意思?
MongoDB shell将二进制数据打印为Base64编码的字符串,该字符串封装在一个函数调用中:
"_id" : BinData(0,"e8MEnzZoFyMmD7WSHdNrFJyEk8M=")
"0"是什么意思?
http://docs.mongodb.org/manual/reference/mongodb-extended-json/#binary
BSON BinData数据类型通过shell中的类BinData表示.运行help misc
获取更多信息.
> new BinData(2, "1234")
BinData(2,"1234")
脱壳
help misc
b = new BinData(subtype,base64str) create a BSON BinData value
在您的 case 中,0
是BSON子类型
http://bsonspec.org/#/specification
binary ::= int32 subtype (byte*) Binary - The int32 is the number of bytes in the (byte*).
subtype ::= "\x00" Generic binary subtype
| "\x01" Function
| "\x02" Binary (Old)
| "\x03" UUID (Old)
| "\x04" UUID
| "\x05" MD5
| "\x80" User defined
在这个问题上也有类似的问题
http://groups.google.com/group/mongodb-dev/browse_thread/thread/1965aa234aa3ef1e