loopbackio / loopbackio/loopback-connector-mongodb
v7.0.0-alpha.1 - MongoInvalidArgumentError: Argument "options" must not be function
Open
Nobody has claimed this yet.
bug
v7.x
- Dominant language
- JavaScript
- Stars
- 186
- Forks
- 238
- Avg merge
- 2h 49m
- Merged PRs (30d)
- 1
Description
Steps to reproduce
const cursor = (await this.studyRepository.execute(
'Study',
'aggregate',
[
{
$facet: {
StudyCount: ...,
SampleTypeCount: ...,
},
},
],
)) as AggregationCursor;
Current Behavior
MongoInvalidArgumentError: Argument "options" must not be function
at Collection.aggregate (d:\dev\lien\samplebox-web-backend\node_modules\loopback-connector-mongodb\node_modules\mongodb\lib\collection.js:371:19)
at d:\dev\lien\samplebox-web-backend\node_modules\loopback-connector-mongodb\lib\mongodb.js:602:38
Expected Behavior
working code in 6.2.0
Link to reproduction sandbox
Additional information
win32 x64 18.15.0
├── @loopback/authentication-jwt@0.12.9
├── @loopback/authentication@9.0.9
├── @loopback/authorization@0.12.9
├── @loopback/boot@5.0.9
├── @loopback/core@4.0.9
├── @loopback/repository@5.1.4
├── @loopback/rest-explorer@5.0.9
├── @loopback/rest@12.0.9
├── @loopback/service-proxy@5.0.9
├── loopback-connector-mongodb@7.0.0-alpha.1
├── mongodb@5.2.0
Related Issues
See Reporting Issues for more tips on writing good issues
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.
Research direction
Start by reproducing the aggregate call with loopback-connector-mongodb 7.0.0-alpha.1 and mongodb 5.2.0, then inspect lib/mongodb.js around line 602 and the Collection.aggregate call shown in the stack trace. Done means the provided aggregate operation no longer raises MongoInvalidArgumentError while preserving compatibility with the reported setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mongodb
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100