Automattic / Automattic/mongoose

.select on create or update of a model.

Open
#2,429 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
27.5k
Forks
4k
Avg merge
2d 7h
Merged PRs (30d)
35

Description

It would be nice to be able to select the returned fields from a create/update request.

eg.

```
myModel.create(data).select('name.first').exec(function (err, data) {
//Data only has name.first
});
```

Contributor guide

Open the contributing guide

Research direction

Start at the model create and update entry points and follow the execution path used by the shown .select('name.first').exec example. Compare how returned fields are handled for both operations. Done means the callback data for create and update contains only the selected field, with the behavior covered by the relevant existing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb, nodejs
Domain
backend, database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.