How to remove Duplicate items from siblings filter in Fluent Vapor 4?

48 Views Asked by At

I have a query in Fluent Vapor that applies siblings filters based on metaTagIds. Here's the code snippet:

let queryBuilder = Attraction.query(on: req.db)
if let metaTagIds = attractionSearch.metaTagIds, metaTagIds.count > 0 {
    queryBuilder.join(siblings: \.$metaTags)
    queryBuilder.filter(MetaTag.self, \.$id ~~ metaTagIds)
}

After applying these siblings filters, I want to remove duplicate values from the queryBuilder. How can I achieve this in Fluent Vapor?

Any help or guidance would be appreciated. Thank you!

0

There are 0 best solutions below