Automattic / Automattic/mongoose
support for es6 Set?
- Dominant language
- JavaScript
- Stars
- 27.5k
- Forks
- 4k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 35
Description
I have many mongoose queries models that end up referencing an array of unique ids. An example:
``` javascript
const cursor = BidPackageModel.find({
projectId: {
$in: projectIds,
}
}).cursor()
```
where `projectids` is a set of unique ids I've built up with some little glue logic. Javascript now has a `Set` https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
rather than having to cast a Set into a `projectids` Array , it would be awesome if mongoose was capable of supporting sets directly.
Is this something that would be realistic/feasible in terms of new features?
Contributor guide
Research direction
Start by tracing how Mongoose handles the $in value in the query shown, then identify the relevant query-casting tests or entry points. Done means a JavaScript Set can be passed directly for this use case and tests demonstrate the expected query behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mongodb, nodejs
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100