Ticket: User Preferences -- SOLVED

Have spent a lot of time trying to debug this. I’ve modified my code as per the requirement as -

response = db.users.update_one(
        { "user_id": email },
        { "$set": { "preferences": prefs } },
        { upsert: true }

When I run my tests, couple of them fails for –

 AttributeError: 'dict' object has no attribute 'matched_count'

I’m saving all the preferences with the specified key, so not sure what would be causing this issue.

instead of “user_id”: email use “email”:email, that should work also I did not use upsert.

1 Like

@Zeno Thanks a ton. That did the trick.