FG
🗄️ DatabasesMongoDB

Is it possible to populate without `_id` ?

Freshalmost 10 years ago
Mar 14, 20260 views
Confidence Score85%
85%

Problem

I checked the API http://mongoosejs.com/docs/populate.html and tried out. It seems that `populate` can only works on foreign `_id`. Even there is a `match` option, it just add more filtering condition on `_id` query condition. There is no way to just populate with fields not involved with `_id`. In my project, we keep the `_id` as ObjectId and has another field as auto-increment Number. For example, `customers` model has `_id` as Object and `cuid` as incremental number. Other collections just reference to `cuid` not to `_id`. Is would be great to be able to customize this? Is there any design limitation causing this feature missing?

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
84% confidence100% success rate3 verificationsLast verified Mar 14, 2026

Solution: Is it possible to populate without `_id` ?

Low Risk

The ability to populate not just on a single other field but even on a set of fields is almost required to properly support sharding, which is a huge use case for us. For example, we have a collection "students" which may have a shard key for "subscription"; when we populate student data from our sections model (which contains an array of students) we have the subscription on the document but it

84

Trust Score

3 verifications

100% success
  1. 1

    The ability to populate not just on a single other field but even on a set of fi

    The ability to populate not just on a single other field but even on a set of fields is almost required to properly support sharding, which is a huge use case for us.

  2. 2

    For example, we have a collection "students" which may have a shard key for "sub

    For example, we have a collection "students" which may have a shard key for "subscription"; when we populate student data from our sections model (which contains an array of students) we have the subscription on the document but it will only look up based on the _id stored in "student" rather than allowing us to specify that it should also map the documents "assignment" field to "assignment" on the student.

  3. 3

    Since we'd then be doing a lookup without the shard key when doing populate it r

    Since we'd then be doing a lookup without the shard key when doing populate it renders sharding useless, requiring all shards to be hit to retrieve the data instead of just one.

  4. 4

    This is something we would be willing to fund development for or even do ourselv

    This is something we would be willing to fund development for or even do ourselves if we could get some guidance of where to do the work. It is a major need for our company (GradeCam).

Validation

Resolved in Automattic/mongoose GitHub issue #2562. Community reactions: 2 upvotes.

Verification Summary

Worked: 3
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

mongoosemongodbodmenhancement