loopbackio / loopbackio/loopback-connector-mongodb

v7.0.0-alpha.1 - MongoInvalidArgumentError: Argument "options" must not be function

Open
#729 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.