#๐Ÿ”’ updateOne MongoDB Data API isnt working for me

11 messages ยท Page 1 of 1 (latest)

blissful ravine
#

header = {"Accept": "application/json", "apiKey": api_key}

data = {"dataSource": "Cluster0", "database": "CrownStudios", "collection": "BANS", "filter": {"text": "These are the stored banned ids for Low Poly FPS!"}, "update": {"$pull": {"bans": {1425085558}}}}




r = requests.post(data_api, json=data, headers=header)


print(r.json())

Whenever i used $pullAll, my code worked, but had no effect (1425085558 wasnt deleted from the array "bans") When i use $pull, it gives me this error

TypeError: Object of type set is not JSON serializable

But i never specified any set?

sullen wingBOT
#

@blissful ravine

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

candid oracle
#

Yes you did {"bans': {1425085558}} is a dict[str, set[int]]

candid oracle
#

@blissful ravine ^

blissful ravine
#

.

#

well it still doesnt change anything

#

when i changed it back

candid oracle
candid oracle
sullen wingBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.