Hi @Frank_Numrich1, Welcome back,

I think there is no any better approach, but below is the same just a short-hand approach of the $cond operator.

{
    $set: {
      completedTime: {
        $cond: ["$isLastReceiveTime", "$$NOW", "$$REMOVE"]
      },
      complete: {
        $cond: ["$isLastReceiveTime", true, "$$REMOVE"]
      }
    }
  }
1 Like