loopbackio / loopbackio/loopback-next

Where filter with `neq` doesnot work as expected

Aperta
#6,518 10 commenti 3 reazioni 1 assegnatario Vedi su GitHub

@hacksparrow ci sta già lavorando.

Dal 20/10/2020.

bug needs steps to reproduce
Lingua principale
TypeScript
Stelle
5.1k
Fork
1.1k
Merge medio
2g 21h
PR unite (30g)
27

Descrizione

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)

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.