db.mycol.find()。漂亮()
{
" _id":ObjectId(7df78ad8902c),
" title":" MongoDB概述",
" description":" MongoDB不是sql数据库",
" by":" Mongo DB",
"标签":[" mongodb","数据库"," NoSQL"],
"喜欢":" 100"
}
输出继电器: "标记"的值必须修改密钥。
{
" _id":ObjectId(7df78ad8902c),
" title":" MongoDB概述",
" description":" MongoDB不是sql数据库",
" by":" Mongo DB",
"标签":[" mongodb","数据库"," NoSQL"," Robomongo",& #34;速度&#34],
"喜欢":" 100"
}
提前感谢您的回答。
答案 0 :(得分:0)
使用$push
运算符。例如,添加" Robomongo"到tags数组,你可以这样做:
db.mycol.update(<query to get the doc to update>, { $push: { tags : "Robomongo"} })