loopbackio / loopbackio/loopback-connector-sqlite3

Exception when object field not included in fields list of find or findOne

Open
#34 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
13
Forks
21
PR merge metrics
No merged PRs in 30d

Description

Bug or feature request
  • [X ] Bug
  • Feature request
Description of feature (or steps to reproduce if bug)
  1. Define a model with {field1: {type: 'number}, field2: {type: object'}}
  2. Create a model record
  3. Retrieve the model record with fields: ['field1']
Link to sample repo to reproduce issue (if bug)

https://github.com/aams/loopback-connector-sqlite3

Expected result

No crash

Actual result (if bug)

Exception "Uncaught SyntaxError: Unexpected token u in JSON at position 0"

Additional information (Node.js version, LoopBack version, etc)

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 by reproducing the issue in the linked loopback-connector-sqlite3 sample with a model containing a number and object field, then trace the find and findOne entry points when only field1 is requested. Done means retrieving the record with fields: ['field1'] completes without the JSON parsing exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, sqlite
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.