68 lines
1.4 KiB
Plaintext
68 lines
1.4 KiB
Plaintext
|
|
// all sorted by date
|
|
|
|
db.getCollection("switch").find({})
|
|
.projection({})
|
|
.sort({date: -1})
|
|
.limit(0)
|
|
|
|
|
|
// replace task id
|
|
|
|
db.switch.updateMany(
|
|
{ task: "9719a462" },
|
|
{ $set: { task: "c6b0af75" } }
|
|
)
|
|
|
|
|
|
// find all after date
|
|
|
|
db.switch.find(
|
|
{ date: { $gt: ISODate("2025-02-13T11:00:00-03:00") } }
|
|
).pretty()
|
|
|
|
|
|
// update task after date
|
|
|
|
db.switch.updateMany(
|
|
{ date: { $gt: ISODate("2025-02-13T11:00:00-03:00") } },
|
|
{ $set: { task: "f6f23db6" } }
|
|
)
|
|
|
|
// find tasks between dates
|
|
|
|
db.getCollection("switch").find({
|
|
task: { $in: ["f217b606", "7422cfe3", "acbd9f7f", "9719a462", "c6b0af75", "be7e496f", "51c5b6d6"] },
|
|
date: {
|
|
$gte: ISODate("2025-02-03T00:00:00-03:00"),
|
|
$lt: ISODate("2025-02-05T00:00:00-03:00")
|
|
}
|
|
})
|
|
.projection({})
|
|
.sort({ date: -1 })
|
|
.limit(0)
|
|
|
|
// sum active task between dates
|
|
|
|
db.getCollection("switch").aggregate([
|
|
{
|
|
$match: {
|
|
task: { $in: ["f217b606", "7422cfe3", "acbd9f7f", "9719a462", "c6b0af75", "be7e496f", "51c5b6d6"] },
|
|
date: {
|
|
$gte: ISODate("2025-02-01T00:00:00-03:00"),
|
|
$lt: ISODate("2025-02-17T00:00:00-03:00")
|
|
},
|
|
workspace: { $in: ["Think", "Plan", "Work"] } // New filter for workspace
|
|
}
|
|
},
|
|
{
|
|
$group: {
|
|
_id: null,
|
|
totalDelta: { $sum: "$delta" }
|
|
}
|
|
}
|
|
])
|
|
|
|
|
|
|