Why new documents in mongo have an object and not an ObjectId?

前端 未结 3 2061
青春惊慌失措
青春惊慌失措 2021-01-18 17:08

When inserting new documents in mongodb, ids don\'t look like ObjectId and instead they look like an object.

\"_id\" : {
        \"_bsontype\" : \"ObjectID\"         


        
3条回答
  •  不知归路
    2021-01-18 17:38

    I was having the same issue here: ObjectID not storing hexadecimal value

    It's definitely an issue with environments and something strange with the brew installation of MongoDB. I found that uninstalling from brew and reinstalling manually solved my issue. http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/

    While I didn't figure out from a code/technical standpoint why it is returning the 12-byt BSON ObjectID rather than the Hexadecimal ObjectID... uninstalling MongoDB from brew and reinstalling it manually solved the issue.

提交回复
热议问题