init_propertyvalue.py 411 B

12345678910111213141516171819202122232425
  1. # coding=utf-8
  2. '''
  3. Created on 2016年4月6日
  4. @author: ChenHao
  5. '''
  6. from pymongo.mongo_client import MongoClient
  7. from util_common import Constant
  8. '''
  9. 将propertyvalue_temp里面的propertyid的str清洗为int
  10. '''
  11. cli = MongoClient(Constant.MONGODB_URL)
  12. db = cli.spider
  13. rs = db.propertyvalue_temp.find()
  14. for r in rs:
  15. r["propretyid"] = int(r["propretyid"])
  16. db.propertyvalue_temp.save(r)
  17. cli.close()