Field undefined fails to update to null with mongoid ODM


I am am using mongoid ODM to create and update my data. If I create a document with one field not persisted, this field will be considered undefined ($exists: false). However, If I update this field with nil (null value for rails), it won’t be always updated to null in mongoDB, but stays undefined. I wonder why it behaves like that, and can I update the field to null from mongoid?

Thanks a lot.

Hi @Xinying_Hu, sorry for the delay in responding, but can you share short code example to illustrate what you mean? This would help us answer you better.