Update document requires atomic operators

Hello, working on the chapter 3 lab in the M001 course where the ask is to add a boolean capital to Albany and NY City New York using the sample_training, zips db.
My thinking is, identify the New York state documents with the city ALBANY and add the field using $set.
I’ve tried this
db.zips.updateMany({“city”:“ALBANY”},{“state”:“NY”},{$set: {“capital?”:true}})
but get anupdate document requires atomic operators. I think it doesn’t like that I’m searching by 2 items but I can’t seem to figure out how to look for both city and state and then update the resulting set.
can anyone point me in the right direction?
thank you,
paul

This is incorrect syntax. You want to have both of your matches in a single set of curly brackets.

Try

db.zips.updateMany(
    {
        "city": "ALBANY",
        "state": "NY"
    },
    {
        "$set": {
            "capital?": true
        }
    }
)
1 Like

ahhhh!!! got it, thank you so much for the rookie course correct!!!

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