惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tailwind CSS Blog
博客园 - 【当耐特】
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - Franky
小众软件
小众软件
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 三生石上(FineUI控件)
B
Blog
有赞技术团队
有赞技术团队
J
Java Code Geeks
云风的 BLOG
云风的 BLOG
Recent Announcements
Recent Announcements
Jina AI
Jina AI
Vercel News
Vercel News
博客园 - 叶小钗
Hugging Face - Blog
Hugging Face - Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
F
Fortinet All Blogs
The Cloudflare Blog
V
V2EX
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园_首页
腾讯CDC

博客园 - 文刀无尽

图片加到json中,提交到服务器端处理异常问题。 在django中使用时django-nonrel,'django.contrib.auth'不能用的问题 在mac 上安装 mpkg 在bluehost上安装mongodb Celery使用数据库代替rabbitmq 为什么要使用Rabbitmq 在bluehost上安装pytoh 2.7.2 为android 启动的时候添加splash 折腾了半天,ajax 在模拟器下正常,在一台2.1机器上正常,在我的小米2.3下不工作 去掉默认标题栏且将应用设置为全屏 java 基本语法 在jquery mobile中页面跳转的时候,实现登录检查 去掉jquery mobile 的阴影效果 Eclipse 的 javascript 插件 iphone phonegap中跨域的问题 使用jquery mobile 经验 另类随机读大表数据 (原创)自已实现服务器控件之 TextBox 控件 (原创)自已实现服务器控件系列 之 设计时可用鼠标拖动大小的Label控件
在Django 中更新mongodb的ListField字段
文刀无尽 · 2012-04-08 · via 博客园 - 文刀无尽

1, 导入        MongoDBManager

from django_mongodb_engine.contrib import MongoDBManager

2. 在models 中的Article加入 

objects = MongoDBManager() 

3. 开始更新。 

Article.objects.raw_update({"_id": ObjectId(object_id_input)}, {"$push": {"comments":

                                                                        {"_id":comment_id,

                                                                         "user":ObjectId(user_id_input),

                                                                         "content":content_input,

                                                                         "ip_address":ip_address_input,

                                                                         "created":datetime.now(),

                                                                         "is_private":0,

                                                                         "flow_status":0}

                                                                                   }

                                                                        })