loopbackio / loopbackio/loopback-connector-mongodb

fields filter gets applied to elements to include v5.6.0

Open
#648 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug v5.x v6.x
Dominant language
JavaScript
Stars
186
Forks
238
Avg merge
2h 49m
Merged PRs (30d)
1

Description

## Steps to reproduce

Model A belongsTo ModelB
Model A has properties id, A, B, C, modelBId
Model B has properties id, A, D, E

Make any query without specifying scope: fields for the included models:
{
fields: ['id', 'A', 'modelB'],
include: ['modelB']
}

## Current Behavior

result is as follows: [{id, A, modelB: {id, A}}]

## Expected Behavior

included models should have all properties: [{id, A, modelB: {id, A, D, E}}]

## Additional information

Bug introduced in latest minor version, mongodb.js:1403

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at mongodb.js:1403 and reproduce the belongsTo query from the issue using the v5.6.0 behavior. Compare the selected fields on the root model with the included Model B, and confirm that the included model retains all properties when no include-specific fields scope is provided.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.