Hello @Scott_Wager, the $unset update pipeline stage is used to remove (or exclude) field(s) from the document in an update operation. I’d like some clarification about what you had posted.
if the field `notes.title` exists,
then 'notes.highlights' = true // setting a boolean true (or is it remove this field)
else notes = true // setting a boolean true (or is it remove this field)
setting a boolean true (or is it remove this field) - what you are trying to say is not clear. Can you post a sample document with the two possible outcomes?
@Scott_Wager, I have this solution (and it works fine). I suspect there might be “better” way of doing this. The syntax needs to be same for this to work.