pymongo Questions
2
Solved
As far I know, currently MongoDB TTL are managed by expireAfterSeconds index and it's setting for all documents inside a collection.
Is there any built-in way to set expiration to single document?
...
3
Solved
I want to push some values into array using Python.
Maybe next time when i update the array ,it will insert some values exists ,so it will got some duplicate values.
I want to know is there anyway ...
Chew asked 9/4, 2016 at 15:10
9
I want to get the string character from an ObjectId object. I use pymongo.
eg: ObjectId("543b591d91b9e510a06a42e2"), I want to get "543b591d91b9e510a06a42e2".
I see the doc, It says ObjectId.toStr...
2
When I am using pymongo 3.7 transaction function to connect to mongo server 4.0, this error "Transaction numbers are only allowed on a replica set member or mongos" occurred and I cannot find any a...
Supply asked 9/7, 2018 at 5:55
2
Solved
I'm storing lists of tuples into a MongoDB database using PyMongo. For some reason, when I view the data in the mongo shell, the tuples are represented by square brackets.
In addition, when I extr...
2
Solved
I need to search an ObjectId with python using pymongo but I always get an error.
import pymongo
from pymongo import MongoClient
from pymongo import ObjectId
gate = collection.find({'_id': ObjectI...
4
Solved
I am using PyMongo to simply iterate over a Mongo collection, but I'm struggling with handling large Mongodb date objects.
For example, if I have some data in a collection that looks like this:
"...
Goins asked 6/11, 2018 at 18:10
4
When I start some of my services, it reports such warnings and the services stop:
/usr/lib64/python2.6/site-packages/pymongo/topology.py:75:
UserWarning: MongoClient opened before fork. Create Mo...
2
Solved
how to get the list of all the databases in a mongo instance to a variable using pymongo?
for example to send following command to mongo instance using pymongo,
db.adminCommand( { listDatabases: 1 ...
6
Solved
I am following the Python tutorial from W3Schools. I just started the MongoDB chapter. I installed MongoDB and checked it with:
import pymongo
without getting an error.
But as soon as I enter the ...
Pennsylvania asked 24/3, 2020 at 21:15
3
I have a web application written with python and the async framework Starlette (https://www.starlette.io/), I need to connect to MongoDB, so I installed the async pymongo driver: motor (https://mot...
Threemaster asked 21/2, 2020 at 21:50
5
Solved
I'm trying to connect to my mongodb atlas cluster but i keep getting timed out as soon as i try to do something with my db.
The db i use was created in mongoshell and also the collection i checke...
Clambake asked 25/7, 2018 at 19:14
2
Solved
The documentation shows how to do it with mongosh, but how do you create Time Series Collection using pymongo from within a python script?
import pymongo
import time
from datetime import datetime
...
4
Solved
I am trying to insert document using mongoengine in my python script but it raises this exception
(<class 'pymongo.errors.InvalidName'>, InvalidName("database names cannot contain the charac...
3
Solved
In another question (How do I copy a collection from one database to another database on the same server using PyMongo?) I figured out how to copy one MongoDB collection to another database on the ...
6
Solved
I need to check if a find statement returns a non-empty query.
What I was doing was the following:
query = collection.find({"string": field})
if not query: #do something
Then I realized that my...
Longfaced asked 24/10, 2014 at 14:18
3
I have built a docker image for a flask app I have with some html templates and after running my image I go to localhost:5000which takes me to the start page in my flask app . I press a register bu...
13
Solved
What is the quickest way to insert a pandas DataFrame into mongodb using PyMongo?
Attempts
db.myCollection.insert(df.to_dict())
gave an error
InvalidDocument: documents must have only strin...
Chaves asked 23/11, 2013 at 20:1
6
Solved
I have installed mongodb and enabled auth. and its working find. I can connect it from remote notebook using robomongo application:
Host: SERVER_IP
PORT: 27017
DATEBASE: prod-db
USERNAME: user_nam...
5
Solved
I have currently django-mongodb-engine 0.4.0 version installed on my Mac OS X 10.6.8 and weirdly encountered an interesting error while importing the 'compiler' module:
>> from django_mongod...
Mlawsky asked 14/5, 2012 at 8:19
8
Solved
I am using pymongo to query for all items in a region (actually it is to query for all venues in a region on a map). I used db.command(SON()) before to search in a spherical region, which can retur...
Randirandie asked 10/3, 2015 at 16:10
8
Solved
In particular, I am currently trying to check if a connection to a client is valid using the following function:
def mongodb_connect(client_uri):
try:
return pymongo.MongoClient(client_uri)
exc...
2
Solved
I am having some issues inserting into MongoDB via FastAPI.
The below code works as expected. Notice how the response variable has not been used in response_to_mongo().
The model is an sklearn Elas...
6
Solved
I am new to pandas (well, to all things "programming"...), but have been encouraged to give it a try.
I have a mongodb database - "test" - with a collection called "tweets".
I access the database ...
16
Solved
I have a large amount of data in a collection in mongodb which I need to analyze. How do i import that data to pandas?
I am new to pandas and numpy.
EDIT:
The mongodb collection contains sensor v...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.