PyMongo $inc having issues

后端 未结 2 1951
独厮守ぢ
独厮守ぢ 2021-01-13 02:46

When trying to use $inc I get a Syntax error stating that $set is wrong. My query is as follow:

mongo_db.campaign.update({\'_id\': str(campaign_id)}, { $inc:         


        
2条回答
  •  爱一瞬间的悲伤
    2021-01-13 03:15

    pymongo == 2.7 
    campaign_id = bson.ObjectId(campaign_id)
    mongo_db.campaign.update({'_id': campaign_id}, {'$inc': {'item': 1}})
    

提交回复
热议问题