mongodb

MongoDB Atlas ServerSelectionTimeoutError: SSL handshake failed

MongoDB Atlas ServerSelectionTimeoutError: SSL handshake failed Question: I’m having a hard time fetching some data from my mongodb database using pymongo driver. I keep getting the following error: pymongo.errors.ServerSelectionTimeoutError: SSL handshake failed: ac-mtxrap4-shard-00-01.vfg8vpd.mongodb.net:27017: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:1007),SSL handshake failed: ac-mtxrap4-shard-00-00.vfg8vpd.mongodb.net:27017: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:1007),SSL handshake failed: ac-mtxrap4-shard-00-02.vfg8vpd.mongodb.net:27017: [SSL: TLSV1_ALERT_INTERNAL_ERROR] …

Total answers: 1

Finding a specific element in nested Array MongoDB

Finding a specific element in nested Array MongoDB Question: DB Schema [{ "_id": 1, "name": "city1", "districts": [ { "id": 5, "name": "district 1", "neighborhoods": [ { "id": 309, "name": "neighborhood 1" } ] }, { "id": 6, "name": "district 2", "neighborhoods": [ { "id": 52280, "name": "neighborhood 2" } ] } }, { "_id": …

Total answers: 1

How to access nested data in Dask Bag while using dask mongo

How to access nested data in Dask Bag while using dask mongo Question: Below is the sample data – ({‘age’: 61, ‘name’: [‘Emiko’, ‘Oliver’], ‘occupation’: ‘Medical Student’, ‘telephone’: ‘166.814.5565’, ‘address’: {‘address’: ‘645 Drumm Line’, ‘city’: ‘Kennewick’}, ‘credit-card’: {‘number’: ‘3792 459318 98518’, ‘expiration-date’: ’12/23′}}, {‘age’: 54, ‘name’: [‘Wendolyn’, ‘Ortega’], ‘occupation’: ‘Tractor Driver’, ‘telephone’: ‘1-975-090-1672’, ‘address’: {‘address’: …

Total answers: 1

PyMongo save List of dict in subfield with own ObjectId for every dict entry

PyMongo save List of dict in subfield with own ObjectId for every dict entry Question: I’m creating a list of Objects in my script, and want so save/update them in a subfield of an mongo db document. My Objects looks like this: class IndividualRating: def __init__(self, place=0, player="", team="", games="", legs=""): self.place = place self.player …

Total answers: 1

Pymongo usage with vpn

Pymongo usage with vpn Question: I am kinda new to pymongo. Is there any possible way to connect to mongodb with the usage of the VPN, if I have server address, login and password of the vpn server? I have googled, but didn’t find anything useful. Asked By: Mikhail Zhokhov || Source Answers: Sure, here …

Total answers: 1

Update a specific array element if it fulfils at least one of several conditions

Update a specific array element if it fulfils at least one of several conditions Question: I am trying to understand (and fix) a code that is not mine, which uses PyMongo. We want to look for the document with _id==_id that has, inside its list comments, a comment with id==comment_id or id==PyObjectId(comment_id). To that comment …

Total answers: 1

POST request to a nested query – python API

POST request to a nested query – python API Question: So i’ve began to create a comment section for users to leave comments under posted events. I’m now trying to set up replies to comments under an event and am having issues. With the code I have, a new link is being generated but it …

Total answers: 1

Cannot sink Windowed queried streaming data to MongoDB

Cannot sink Windowed queried streaming data to MongoDB Question: Using Spark Structured Streaming I am trying to sink streaming data to a MongoDB collection. The issue is that I am querying my data using a window as following: def basicAverage(df): return df.groupby(window(col(‘timestamp’), "1 hour", "5 minutes"), col(‘stationcode’)) .agg(avg(‘mechanical’).alias(‘avg_mechanical’), avg(‘ebike’).alias(‘avg_ebike’), avg(‘numdocksavailable’).alias(‘avg_numdocksavailable’)) And it seems that mongodb …

Total answers: 1

Positional operator not working in MongoDB with array elements FastAPI

Positional operator not working in MongoDB with array elements FastAPI Question: I have a document that looks like this: { "_id": "cc3a8d7f-5962-47e9-a3eb-09b0a57c9fdb", "isDeleted": false, "user": { "timestamp": "2023-02-12", "name": "john", "surname": "doe", "email": "[email protected]", "phone": "+012345678912", "age": 25, "gender": "female", "nationality": "smth", "universityMajor": "ENGINEERING", "preferences": null, "highPrivacy": false, }, "postings": [ { "id": "f61b103d-8118-4054-8b24-b26e2f4febc4", "isDeleted": …

Total answers: 1

How to prevent duplication in update statement

How to prevent duplication in update statement Question: I have documents like this in my MongoDB collection: my_dict = {"chat": 1, "entity": 2, "count": 55} I need to update them and if the document does not exist (entirely), then insert a new one: results_collection.update_one(my_dict, {"$set": {"chat": 1, "entity": 2, "count": 60}}, upsert=True) But if the …

Total answers: 1