diff --git a/docs/challenge/network.mdx b/docs/challenge/network.mdx index 44e995f..e79e2ee 100644 --- a/docs/challenge/network.mdx +++ b/docs/challenge/network.mdx @@ -13,28 +13,33 @@ The provided scripts are incomplete. Replace all `` with the correct ```python from datetime import datetime, timedelta +from zoneinfo import ZoneInfo # Calculate the date and time 24 hours from now -delete_after = (datetime.utcnow() + timedelta(hours=24)).isoformat() + 'Z' +delete_after = (datetime.now(ZoneInfo('UTC')) + timedelta(hours=24)).isoformat() !atlas accessLists ``` :::tip Docs : atlas [accessList](https://www.mongodb.com/docs/atlas/cli/current/command/atlas-accessLists/#std-label-atlas-accessLists) +:::
Answer ```python - from datetime import datetime, timedelta +from datetime import datetime, timedelta +from zoneinfo import ZoneInfo # Calculate the date and time 24 hours from now -delete_after = (datetime.utcnow() + timedelta(hours=24)).isoformat() + 'Z' +delete_after = (datetime.now(ZoneInfo('UTC')) + timedelta(hours=24)).isoformat() -!atlas accessLists create --currentIp --projectId {project_id} --deleteAfter "{delete_after}" +!atlas accessLists --projectId {project_id} --deleteAfter {delete_after} ```
+:::info +The IP added is the "local" IP for the environment running the notebook. If you're running this in Collab / Codespaces this local IP will not be your computer's local IP. ::: ### 2. Check that "My current IP" was added @@ -42,6 +47,8 @@ delete_after = (datetime.utcnow() + timedelta(hours=24)).isoformat() + 'Z' !atlas accessLists list --output json --projectId {project_id} ``` +You should get a JSON document that contains information in the `results` array. + ## Next steps Start the chapter on [authentication](./authentication) for database user management.