Skip to content

feat: improve forgeStageTwoQuery to allow select/omit for singular model populate #1627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

DominusKelvin
Copy link

@DominusKelvin DominusKelvin commented Apr 11, 2025

Resolves balderdashy/sails#4667

I also account for the normal behaviour of Waterline projections not allowing both select and omit

CleanShot 2025-04-11 at 14 58 44@2x

Now this sort of subcriteria will be treated as valid subcriteria for populating associations

 const tickets = await Ticket.find({
      where: { event: event.id, status: { '!=': 'cancelled' } },
      sort: 'ticketHolderEmail DESC',
      select: ['ticketHolderEmail', 'status', 'publicId']
    })
      .populate('ticketType', { select: ['name'] })
      .populate('order')

@DominusKelvin DominusKelvin changed the title feat: improve forgeStageTwoQuery to allow select/omit as for singular model populate feat: improve forgeStageTwoQuery to allow select/omit for singular model populate Apr 11, 2025
@luislobo
Copy link
Contributor

luislobo commented Jul 7, 2025

Good improvement! It would be good to have unit tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

.populate('petType', {select: ['species']}) ("Ambiguous usage with singular model association")
2 participants