I’m trying to write a $set query which contain empty values.
The golang bson command is pretty simple:
update := bson.A{
bson.D{{"$set", bson.D{
{"profile", bson.D{
{"fieldName", bson.D{}},
}},
}}},
}
The error => Invalid $set :: caused by :: an empty object is not a valid value. Found empty object at path profile.fieldName
I’v search the internet for a solution without luck. I’ve discovered that this should work on any mongodb server since version 5.0. My server is at version 6.0
The exact same query works fine when using the mongosh console inside Mongo Compass on the same server.
Did I miss something ?