balderdashy / balderdashy/sails
in operator does not work if used with ID-Field.
- Dominant language
- JavaScript
- Stars
- 22.8k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
**Waterline version**: 0.11.12
**Node version**: 8.9.3
**NPM version**: 5.5.1
**Operating system**: Win 10
I tried the following query with a MongoDB model:
```
Device.find({
id: ["5c177821b081731b30011027", "5c18f98fa845431d48118745", "5c190534fea0583f3c10f9b4"]
});
```
Gives me 0 results. The same query in native MongoDB works:
```
db.getCollection("device").find({
_id: {
"$in": [ ObjectId("5c177821b081731b30011027"), ObjectId("5c18f98fa845431d48118745"), ObjectId("5c190534fea0583f3c10f9b4"), ObjectId("5c1910de1b9809431ce42c27") ]
}
});
```
I guess the id-strings are not converted to `ObjectId`s?
Contributor guide
Research direction
Start by reproducing the MongoDB model query with Device.find and compare its results with the native MongoDB query shown in the report. Trace how the id array is handled and verify that the query returns the matching devices when complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mongodb, node.js
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100