MongoDB 常用查询语句/技巧
· 阅读需 1 分钟
转换为 UTC 时间字符串
// 转换为 UTC 时间字符串
db.collection.find({
timestamp: { $gte: new Date( new Date("2025-03-22T00:00:00+08:00").toISOString()) }
});
创建视图
// ============== AI800 A相进线温度 ==========
db.AI800.drop();
db.createView(
"AI800", // 视图名称
"equipment-1123", // 源集合
[
{ $match: { "code": "AI424" } }, // 过滤条件
]
)
db.AI800.find();