Chaining ? commands

I find the following will execute the first part of the conditional update. But the last conditional update is ignored. cocept - part 1 => IF X do Y add comma then part 2 If A do B. Here’s my code. So suggestions. but my understanding / experience is still very weak.

db.zips.updateMany({
		   "city":"REDMOND",
	           "state":"WA"
                   },
                   {$set:{"TechTown":"big"}
                  },
                 
                  {
		   "city":"BRINNON",
	           "state":"WA"
                   },
                   {$set:{"TechTown":"small"}
                  }

                 )

If you look at the updateMany() documentation you will see that you can specify only one filter and one update operation.

You want to use bulkWrite() to do this kind of multiple updates.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.