发布于 2015-09-14 15:13:11 | 70 次阅读 | 评论: 0 | 来源: 网络整理
2.3.2 新版功能.
_hashBSONElement is an internal command that computes the MD5 hash of a BSON element. Eight (8) bytes are returned from the 16 byte MD5 hash.
参数: |
|
---|---|
返回: | A document consisting of key, seed, out and ok fields. |
Fields: |
|
注解
_hashBSONElement is an internal command that is not enabled by default. _hashBSONElement must be enabled by using --setParameter enableTestCommands=1 on the mongod command line. _hashBSONElement cannot be enabled during run-time.
Example
mongod --setParameter=enableTestCommands=1
Example
Hash an ISODate string:
> db.runCommand({_hashBSONElement: ISODate("2013-02-12T22:12:57.211Z")})
Which returns the following document:
{
"key" : ISODate("2013-02-12T22:12:57.211Z"),
"seed" : 0,
"out" : NumberLong("-4185544074338741873"),
"ok" : 1
}
Hash the same ISODate string but specify a seed value:
> db.runCommand({_hashBSONElement: ISODate("2013-02-12T22:12:57.211Z"), seed:2013})
Which returns the following document:
{
"key" : ISODate("2013-02-12T22:12:57.211Z"),
"seed" : 2013,
"out" : NumberLong("7845924651247493302"),
"ok" : 1
}