【发布时间】:2014-11-15 23:32:08
【问题描述】:
我使用 MongoTemplate 来处理 MongoDB
我想将文档的列更新为当前时间
在 Mongodb 命令行客户端中,它可以使用
db.collectionName.update({_id:1}, {timeCol: new Timestamp()}); 要么 db.collectionName.update({_id:1}, {timeCol: new Date()});
但我不知道如何使用 mongoTemplate 来做到这一点。
更新更新; update.set("timeCol", "new Timestamp()"); // 当然,它不起作用
请帮帮我
【问题讨论】:
标签: mongodb mongodb-query spring-data-mongodb