loopbackio / loopbackio/loopback-connector

Filtering with non existing / declared field is ignored / skipped

Open
#125 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted major
Dominant language
JavaScript
Stars
35
Forks
102
Avg merge
14h 26m
Merged PRs (30d)
13

Description

### Bug or feature request

- [x] Bug
- [ ] Feature request

### Description of feature (or steps to reproduce if bug)
1. Insert 10 rows in a model/table
1. Model.find({where: { nonexistingfield: 'test' } })
1. Return 10 rows

https://github.com/strongloop/loopback-connector/blob/97d2aea8686a2c66070696a73d23be0a76d14b97/lib/sql.js#L1096-L1100

### Expected result
Return 0 (Memory connector return 0 and MongoDB Connector too)
In case of SQL this should throw an error ?

### Actual result (if bug)
Return all the documents/rows

### Additional information (Node.js version, LoopBack version, etc)
Only affect SQL connectors using `lib/sql.js`

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 lib/sql.js lines 1096-1100 and reproduce Model.find({where: {nonexistingfield: 'test'}}) after inserting 10 rows. Compare the SQL connector behavior with the stated Memory and MongoDB results. Done means the nonexistent-field filter no longer returns all rows, with the expected SQL error-versus-zero-results behavior decided and covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, sql
Domain
databases
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.