import pymongo
myclient = pymongo.MongoClient(host='localhost',port=27017)
mydb = myclient["du_brand"]
mycol = mydb["content"]
mycol2 = mydb["content_new"]
f1 = mycol.find({"color":{"$exists":True}})
f11 = mycol2.find({"color": {"$exists": True}})
L1 = []
L2 = []
for a1 in f1:
id1 = a1['id']
L1.append(a1)
for a11 in f11:
id11 = a11['id']
L2.append(a11)
for i in L1:
for j in L2:
if i['id'] == j['id']:
print i['color'],j['color']
color = j["color"]
mycol.update({"_id":i["_id"]},{"$set":{"color":color}})