Clearing Optional Fields in Emplace/Update using Null

TLDR Ross asked how to unset a field during an update. Jason confirmed it can be done by sending the field as `null`.

Photo of Ross
Ross
Thu, 15 Dec 2022 02:23:20 UTC

To clear/unset an optional document field while doing an emplace/update (i.e. partial document), should the field be sent as `null` ?

Photo of Jason
Jason
Thu, 15 Dec 2022 03:14:01 UTC

Yes, but this only works in recent RC builds of 0.24.0. In 0.23.1 we unfortunately have this bug: