M220P Write Concerns

On the add_user()…Where can I go to get information on how to change the durability of the writes in Python… I have seen no reference to how to do this…?

# TODO: User Management
        # Insert a user with the "name", "email", and "password" fields.
        # TODO: Durable Writes
        # Use a more durable Write Concern for this operation.

I understand that it involves a w: majority flag… and the ticket references the with options flag… It also says that there are examples in the notebook file write_concerns.ipynb. I opened this and there is no reference on how to insert this… It just is a copy of what the lecture was…

I am unsure on how to add this… Can I get a pointer?

Figured it out…

db.users.with_options(write_concern=WriteConcern(w = "majority")).insert_one({
            "name": name,
            "email": email,
            "password": hashedpw

Hey @David_Thompson,

Are you getting any errors? The section of the code that you shared seems ok. All you now have to do is add a return statement.

The labs expect the python developers to explore the documentation too and hence, it would be good to keep it handy while watching the lectures and answering the labs. That would certainly help a lot! :smile:


1 Like

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