skip to Main Content

MongoDB – How to set the value of a field if it doesn't exist and remain the field if it is already presented in a document

So assume I have a document as shown below: { "_id" : ObjectId("6336d94e0330f5d48e44fb0f"), "systemId" : "5124301", "userId" : "9876543210", "tempId" : "123456da87sdafasdf", "updatedAt" : ISODate("2022-09-30T12:01:11.714+0000"), "receivedAt" : ISODate("2022-04-10T23:15:08.145+0000"), } Now I already have a tempId assigned to the doc and…

VIEW QUESTION
Back To Top
Search