あー...うー...

MongoDBのindexなんだけど、valueのとこにnumberlong(1)とただの1が混じってて、なんだこれって調べてみたところ、

 

ドライバの仕様によっては1じゃなくてNumberLong(1)を使うものがあるが、インデックスの結果に影響はない

Some drivers may specify indexes, using NumberLong(1) rather than 1 as the specification. This does not have any affect on the resulting index.

 

docs.mongodb.com

 

 

ってことらしい。で、なんでそんなことになってるんかと調べてみたが、

 

 

Why doesn’t Mongo output proper JSON? Why does NumberLong() etc exist?

 

The Javascript numbers are represented by the data type Number which a 64-bit floating point type, and Javascript (and JSON) doesn’t have any 64-bit integer data types.

 

 

あたりなのかなぁ...う~ん...

 

ところで、db.hoge.createIndex()はnumberlong(1)を受け付けないっぽい。

なんだこれ...