MongoDB Golang driver custom type with pointer issue

Sorry, I cant edit the post so I append my issue and expectation here:

When field total_for_sale was set to null in database, I still get 0 in Product struct, my expect is to get nil instead, but when I change type TotalForSell to *int64, I can get nil as normal, but it cannot parse empty string or bool any more (it will get error if value in database is string or bool, how can I deal with null when I using custom type? I want to get null intead zero values of custom type
Here is my specifications:

  • golang: v1.23
  • mongo-driver v1.17.1

Thank you