loopbackio / loopbackio/loopback-next
Where filter with `neq` doesnot work as expected
@hacksparrow is already working on this.
Since Oct 20, 2020.
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1.1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 27
Description
# Steps to reproduce
1. Create a entity has `id` property as the following
```js
class Sample extends Entity {
@property({
type: 'string',
id: true,
generated: true,
})
id?: string;
// other properties
}
```
2. Make a query to find samples that not equal the `id`. For example
```js
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)`
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.
Assessment
This issue has not been assessed yet.