I need to remove any element from a Mongo database when I have two databases:
- mydatabase
- data-test-second
With the first database this isn't a problem, I use MongoClient:
self.db = self.client.mydatabase
result = self.db.test.delete_one({"name": 'testelement'})
bBt when I use this for a second database I have a problem with:
self.db = self.client.data-test-second
underlining the database name, how I can write this? Or I can't use this solution for the second name?
self.db = self.client.data - test - secondis a bad example. Please extract and provide a minimal reproducible example. Also, you need to descibe what problem you have, i.e. what you observed when running the example code. As a new user here, also take the tour and read How to Ask.