Questions tagged [pymongo-3.x]

Version 3 of [pymongo]

Version 3 of the official Python driver for MongoDB.

PyMongo 3 is not backward compatible with PyMongo 2:

PyMongo 3.0 brings a large number of API changes. Be sure to read the changes listed below before upgrading from PyMongo 2.x

Warning: PyMongo no longer supports Python 2.4, 2.5, or 3.1. If you must use PyMongo with these versions of Python the 2.x branch of PyMongo will be minimally supported for some time.

See the full changelog for more information.

If you're not sure what version of PyMongo you're running, consider using the generic tag.

324 questions
0
votes
0 answers

Pymongo Client find not working properly

When requesting data from Pythons MongoClient (with connection to the same database and requesting from the same collection) i get less in my result (with or without filtering) for example requesting db.collection.find({}) in the shell gives me 12…
user1724347
  • 253
  • 1
  • 2
  • 13
0
votes
0 answers

python mongo db / How to effectively modify and delete lists in a dictionary?

Here is the data from Mongodb. [ { '_id': ObjectId('5ae348f19268ff41a8e35170'), 'commission': [ {'_id': ObjectId('5ae348f19268ff41a8e35170'), 'commission': [ …
susim
  • 221
  • 5
  • 15
0
votes
1 answer

pymongo How should I specify the data path?

users path common config exchange_rate prod_data delivery_fee site shoppingmall settings description …
susim
  • 221
  • 5
  • 15
0
votes
1 answer

How to query an array inside a document using PyMongo?

I am using python 3.6 and the latest version of mongod. This is my data base. Each document is called 'Module'. I am trying to get all the message_logs of a specific module, that have a specific 'des' value. I tried something like this: filter_param…
Nevo Mashiach
  • 79
  • 1
  • 4
0
votes
2 answers

Flask-pymongo-mongodb. db.collection.drop() not working

I'm trying to delete a collection in mongodb via pymongo,but its not deleting.Where did i go wrong? I have check in stackoverflow for different ways to delete a collection but its not working. Help please code: https://pastebin.com/LEAJXvHP
0
votes
1 answer

Unable to update data in pymongo

I have a JSON POST data that a user is going to send me every time to fetch some data from a third party service.I plan to cache the data based on a scope id so that I don't keep inserting the data each time the user requests for…
Souvik Ray
  • 2,899
  • 5
  • 38
  • 70
0
votes
1 answer

pymongo : bson.errors.InvalidBSON: 'utf8' codec can't decode byte 0xc0 in position

I have a script which copies data from one collection to other. But sometimes scripts stops with following error : Traceback (most recent call last): File "request_archive.py", line 80, in ret = archive_requests(dbType) File…
kadamb
  • 1,532
  • 3
  • 29
  • 55
0
votes
0 answers

upserting an object in MongoDB using PyMongo

I intend to upsert a specific field into existing mongo object like below - from pymongo import UpdateOne # data_dict has less than 1000 items for content_id, content_rank in data_dict.items(): operations.append(UpdateOne( …
comiventor
  • 3,922
  • 5
  • 50
  • 77
0
votes
1 answer

How to avoid null insertion in pymongo?

I have an application where I let users access other third party applications and fetch data from them and perform some visualizations.For the ease of users, I only ask them to send the credentials once through POST request and then store it in…
Souvik Ray
  • 2,899
  • 5
  • 38
  • 70
0
votes
2 answers

Error when try to connect to Replica Set in Mongo

When I try to connect to mongo replica set in AWS I get this error: slavenode:27017: [Errno -2] Name or service not known,ip-XXX-XX-XX-XX:27017: [Errno -2] Name or service not known (where XXX-XX.. corresponds to my actual ip address) The code…
e7lT2P
  • 1,635
  • 5
  • 31
  • 57
0
votes
1 answer

Unable to $unset field in MongoDB nested document

I have a document that looks like the following { "list" :{ "friends": [ { "Name": "John", "Contact": "xyz", "Code": "B" }, { "Name": "Smith", "Contact": "abc", "Code":…
Sivaprasanna Sethuraman
  • 4,014
  • 5
  • 31
  • 60
0
votes
1 answer

Setting TTL(expireAfterSeconds) on created_timestamp object inside my array

So I have a mongo collection called 'abcd', inside my collection I am creating indexes called 'token'. I understand that TTL needs to be tied to a ISO datetime object in mongo as an index, or as part of an array. I was unsuccessful at getting the…
0
votes
0 answers

Trying to connect to pymongo using python 3

I tried to connect to mongodb using pymongo using: Code: from pymongo import MongoClient Client = MongoClient() db = Client["Libraby"] collection = db["book"] book = {} book["title"] = "XYZ" book["name"] = "abc" book["published"] =…
user7733881
0
votes
1 answer

What is the best way to speed up search in MongoDB using multiple indexes?

I have MongoDB collection with 50k+ documents like: { "_id" : ObjectId("5a42190e806c3210acd3fa82"), "start_time" : ISODate("2017-12-25T02:29:00.000Z"), "system" : "GL", "region" : "NY", "order_id" : 3, "task_type" : "px2", …
sortas
  • 1,527
  • 3
  • 20
  • 29