I have been attempting to SSH tunnel into an EC2 instance and connect to DocumentDB that is located in the same VPC. I’ve tried all of the solutions I could dig up online with no luck. I am using the ssh_pymongo module, which wraps SSHTunnelForwarder. I am able to SSH directly into the EC2 instance and connect to the DocumentDB
Tag: pymongo
Unable to update database in Stripe webhook
I have a mongodb database tracking if a user has paid through stripe. Once a user pays, I would like to change the database from False to True. However, even though my webhook seems to be working on the Stripe dashboard, the database isn’t updating. Additionally, if I add a print statement it doesn’t print anything. I am using the
MongoDB/Python – Date in collection (to use for query)
I just started using mongoDB (Version 3.6.8) today, and I like it. I was reading that it should be possible to have a date object directly in the database, but I can’t get it to work. Also I was wondering if it is the best solution or if I should just store my dates as “Epoch millis” instead? I am
pymongo auth failed in python script
I have installed mongodb and enabled auth. and its working find. I can connect it from remote notebook using robomongo application: and We can connect from server shell locally using: Everything works fine, but when we try it using pymongo api. authentications failed. below is the python code: Tools used: Error trace: Solution: problem was with database name, following code
How can I copy one collection from MongoDB using pymongo and paste to another empty collection?
I want to copy full collection (e.g. name ‘home’). Then do some changes in the ‘home’ collection or remove doc inside it (not a collection). And then replace changed ‘home’ collection to its default state from item 1. I do next: But the collection is empty. Answer The problem with your code example is that find() returns a database cursor
How to run MongoDB commands with pymongo?
I need to see list of connections to MongodDB. I know how to do it in mongo console: Now I want to do the same using pymongo. I tried following and it didn’t work: After that I used db.command() in various combinations trying to pass “db.currentOp(true)” to it without success. How to do it properly? The question is how to
pymongo: remove duplicates (map reduce?)
I do have a Database with several collections (overall ~15mil documents) and documents look like this (simplified): They all have an unique _id field as well, but I want to delete duplicates accodring to another field (the external ID field). First, I tried a very manual approach with lists and deleting afterwards, but the DB seems too big, takes very
How to connect to Mongo database locally using python
I am using ipython 2.7. I am creating database name enron in mongodb. I have tried to connect to this database locally but the following error occurred – how do I fix it? this my code: error: Answer Refer this PyMongo Connection to connect and Connection is deprecated
Removing _id element from Pymongo results
I’m attempting to create a web service using MongoDB and Flask (using the pymongo driver). A query to the database returns documents with the “_id” field included, of course. I don’t want to send this to the client, so how do I remove it? Here’s a Flask route: This returns: I thought it was a dictionary and I could just