loopbackio / loopbackio/loopback-next

Where filter with `neq` doesnot work as expected

Offen
#6,518 10 Kommentare 3 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@hacksparrow arbeitet bereits daran.

Seit 20.10.2020.

bug needs steps to reproduce
Vorherrschende Sprache
TypeScript
Sterne
5.1k
Forks
1.1k
Ø Merge
2 T. 21 Std.
Gemergte PRs (30 T.)
27

Beschreibung

Steps to reproduce

  1. Create a entity has id property as the following
class Sample extends Entity {
@property({
    type: 'string',
    id: true,
    generated: true,
  })
  id?: string;
  // other properties
}
  1. Make a query to find samples that not equal the id. For example
const id = '5f7f32799f3b8031a56e4ca8';
const result = this.sampleRepositoy.find(
  {
    where: {
      id: {
        neq: id
      }
    }
  }
)

Current Behavior

result still has the entity with id='5f7f32799f3b8031a56e4ca8'

Expected Behavior

result should exclude the id that I used to filter.
I am using mongo with package: "loopback-connector-mongodb: 5.3.0"
Everything will work if I try to install "mongodb" package and replace neq: id with neq: new ObjectId(id)

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.