Automattic / Automattic/mongoose

There is a way to get populate Query instances?

Open
#12,183 4 comments 2 reactions 0 assignees View on GitHub
new feature
Dominant language
JavaScript
Stars
27.5k
Forks
4k
Avg merge
2d 7h
Merged PRs (30d)
35

Description

### Prerequisites

- [X] I have written a descriptive issue title

### Mongoose version

6.x.x

### Node.js version

19.x

### MongoDB version

6.x

### Operating system

_No response_

### Operating system version (i.e. 20.04, 11.3, 10)

_No response_

### Issue

Hello,

I have to create a populate query that uses the `.distinct()` method on a specific field, however the option is not given by the API and the `.populate()` method doesn't return it's specific Query instance, but the model's Query instance.

I thought that I could call `.distinct()` in the populate Query's instance, but I don't have access to it.

There is a way to do that?

Contributor guide

Open the contributing guide

Research direction

The issue names Mongoose's populate() and distinct() APIs but does not identify files or tests. Start by reviewing how populate queries are exposed and reproduce the behavior with Mongoose 6, Node.js 19, and MongoDB 6; done requires a decided API or documented answer for using distinct() within populate.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb
Domain
backend, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.