loopbackio / loopbackio/loopback-connector-sqlite3
Exception when object field not included in fields list of find or findOne
Open
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)
- Define a model with {field1: {type: 'number}, field2: {type: object'}}
- Create a model record
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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