这个是网站上搜索到的一个Mongodb updateOne原生语句的例子,但却有很大的语法问题。
//语法有问题
db.movies.updateOne( { title: "Tag" },
{
$set: {
plot: "One month every year, five highly competitive friends
hit the ground running for a no-holds-barred game of tag"
}
{ $currentDate: { lastUpdated: true } }
})
不使用对比工具,都很难发现。
只能说Mongodb 这语法也实现是大难学了。使用了太多的标签key.
不想自己写这种mongo shell的语法, 也是可以使用ORM 的方式的。
在此,向大家介绍一款面向互联网的Java ORM Bee,
源码地址:
https://gitee.com/automvc/bee/blob/master/MongodbORM-Function-List.md
https://github.com/automvc/bee/blob/master/MongodbORM-Function-List.md
另外,Bee也是支持直接运行原生的Mongo shell语句的.