KtMongo 0.8.0 is out, which adds support for simpl...
# kmongo
c
KtMongo 0.8.0 is out, which adds support for simple aggregation pipelines! Aggregation pipelines allow querying data in more complex ways than regular request. At the moment, few stages are supported, don't hesitate to request new ones.
Copy code
collection.aggregate()
    .match { User::role eq Role.Player }
    .skip(30)
    .limit(20)
    .toList()
In this version, KtMongo also gains support for update pipelines, allowing to use some pipeline operations to update data:
Copy code
collection.updateManyWithPipeline {
    set {
        User::isPlayer set (of(User::role) eq of(Role.Player))
    }
}
Additionally, this documentation adds a dedicated documentation page to filtered operators:
Copy code
collection.find {
    Invoice::paidAt gteNotNull criteria.minPaidAt
}
as well as filtered collections, which are convenient for logical deletion:
Copy code
val drafts = collection.filter {
    Invoice::status eq Status.Draft
}

drafts.find()
drafts.updateMany { Draft::age inc 1 }
https://opensavvy.gitlab.io/ktmongo/docs
🙌 2