Golang mongo v2 driver wrap int32 into $numberInt

@David_Nasztanovics thanks for the question!

The {“$numberInt”:“0”} object is the Canonical Extended JSON encoding for a 32-bit integer. However, data and queries are passed to MongoDB in BSON format. While Extended JSON can be used to represent BSON data, it isn’t literally what is sent to the database.

I have some questions to help me figure out the problem:

  • Can you provide an example of how you’re using that bson.D filter? For example, are you using it in a MongoDB query like FindOne, or are you trying to marshal it to Extended JSON with MarshalExtJSON?
  • What version of the Go Driver are you using?
  • What version of MongoDB are you using?
1 Like