Litote / kmongo

[deprecated] KMongo - a Kotlin toolkit for Mongo
https://litote.org/kmongo/
Apache License 2.0
781 stars 75 forks source link

How to aggregate objects by regex on list #421

Closed giamat6 closed 1 year ago

giamat6 commented 1 year ago

Hi, I'm trying to extract from 2 collections, where the id of the main as part of a substring into an array inside the second collection. To understand us, you can think about the Google Firestore refs behaviour.

Es: First collection object: { "id": "my-uuid-string"....} Second collection object: {... "refs": "first-collection-name/my-uuid-string"}

Now, I tried several ways to extract the second object list by regex with lookup, pipeline and regex Bson object; but nothing seems to work.

On Compass I successfully extracted the data with concatenation of unwind,match,expr and let variables, but I couldn't translate these to kmongo..

Someone can help me with some tips?

PS: At the moment , I haven't my PC under hands to copy my code, but any help will be very appreciated!

zigzago commented 1 year ago

Sorry, can't help here :(