Start a new topic

Setting field to undefined by business logic

In the console, if I "blank" the data, the column doesn't show

If using business logic I set (using $set within an update) - to null or undefined or empty ("" {} []) the column still shows, generally either with the null value present, or the brackets (if that approach used)

Ideally I think I am meant to be setting to undefined and my expectation is that this will hide the column in the console. As I have hundreds of columns, this is something I want to sort out (rather than just leaving many columns there, even with no data in)

What should I be doing here to completely unset a data field (in business logic) so that the column will hide?

You need to use the $unset operator in your update statement and pass a list of keys with an empty string as the value:

{$unset: {

field1: "",

field2: ""


Ah Ha! Thank you Michael
Login or Signup to post a comment