MongoJStrategy.update(id, {"$push": {“task_names”: task_name}}
主要测试 push 进去的item是否是放在列表最后的位置.
import pymongocld = pymongo.MongoClient("127.0.0.1:27017")data = {"user": "furuiyang","ll": []}# cld.mytest.pushtest.insert(data)print(cld.mytest.pushtest.find({"user": "furuiyang"}).next())cld.mytest.pushtest.update_many({"user": "furuiyang"}, {"$push": {"ll": "000004"}})# cld.mytest.pushtest.update_many({"user": "furuiyang"}, {"$push": {"ll": "000002"}})# cld.mytest.pushtest.update_many({"user": "furuiyang"}, {"$push": {"ll": "000003"}})print(cld.mytest.pushtest.find({"user": "furuiyang"}).next())