UPDATE PYTHON MONGODB (missing 1 required positional argument : self)

I’m new to a python environment in pyramid. My update code keeps getting an error “missing 1 required positional argument : self” in line 76 waterUpdate1 = water1.update(value = 1, volumeInitial = volInitial) Below is my update code in default.py #Update Code in default.py @view_config(route_name = ‘ajax’, match_param = ‘action=waterNow1’, renderer = ‘json’) def waterNow1(self):…

mongodb: how to make selection

I Have a mongodb with objects like this: { “_id” : “7XXXXXXXXXX”, “apps” : [ { “id” : “e0d538e0df9a345e”, “os” : “android”, “token” : “f1zp-VSi7Ec:APA91bEAbfH8nMeVidkIjPrJ28WHRFDy-BhvKCQdDSdCYsylUzET9GjbPHjofCrr1NMQurinMCI4fuiF7VWNPXne-80op_h0MloK217kc1zKptdo9FTgAH5R932uDphcyB1xQ27-AFdR”, “version” : “3.2.1”, “build” : “8115680e”, “timestamp” : NumberLong(1571740696818) } ] } How i can select objects older certain date using timestamp, for example older 3 month?

Why is MongoDB returning null when aggregate function $avg is used on a field

I can’t figure out why this query is not returning anything but null values, the fields have integers in them, some have null values but most have integers. I thought $avg ignored null values. This is the query: db.Companies.aggregate([ {$group:{_id:”$founded_year”,“avgNumEmployees”:{$avg:“$number_of_employees”}}}, {$redact:{$cond:{if:{ $eq:[“$avgNumEmployees”,“null”]}, then: “$$PRUNE”, else:”$$KEEP”} }}).pretty() This some sample data from a document _id: 52cdef7c4bab8bd675297d8a…

MongoDB query array of objects

I have the following collection { “collection”: “user”, “shouldUpdate”: false, “loadOrder”: 1, “data”: [{ “avatarUrl”: “/profiles/photo.do?uid=ddd”, “userName”: “ddd”, “firstName”: “Doron”, “lastName”: “Solomon”, “password”: “password”, “email”: “x@x.com”, “masteries”: [] }, { “avatarUrl”: “/profiles/photo.do?uid=bbb”, “userName”: “bbb”, “firstName”: “Bob”, “lastName”: “Goodman”, “password”: “bWIxNzcz”, “email”: “y@y.com”, “masteries”: [] }] } I am trying to query this coolection and return…

mongodb error while executing aggregation

I would appreciate your help and comments over this. I have been running mongodb without any issues. I am doing a large aggregation and after a while I am getting the following error: com.mongodb.MongoCommandException: Command failed with error 8 (UnknownError): ‘assertion src/mongo/db/pipeline/value.cpp:1365’ on server mongo1:27017. The full response is { “ok” : 0.0, “errmsg” :…