Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: MongoError: {"ok":0,"errmsg":"unallowed argument in listCollections command: batchSize","code":8000,"codeName":"AtlasError"} #244

Closed
buttercubz opened this issue Sep 5, 2021 · 1 comment · Fixed by #245
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@buttercubz
Copy link
Contributor

i am trying to connect to a cluster in mongodb atlas and i am getting this error.

researching in mongodb documentation I found this https://docs.mongodb.com/v5.0/reference/method/cursor.batchSize/#mongodb-method-cursor.batchSize

and notice that the batch size is 1:
https://deno.land/x/mongo@v0.25.0/src/database.ts#L53

error: Uncaught (in promise) Error: MongoError: {"ok":0,"errmsg":"unallowed argument in listCollections command: batchSize","code":8000,"codeName":"AtlasError"}
      throw new MongoError(maybeError);
            ^
    at WireProtocol.commandSingle (https://deno.land/x/mongo@v0.25.0/src/protocol/protocol.ts:38:13)
    at async CommandCursor.<anonymous> (https://deno.land/x/mongo@v0.25.0/src/database.ts:48:23)
    at async CommandCursor.execute (https://deno.land/x/mongo@v0.25.0/src/protocol/cursor.ts:34:18)
    at async CommandCursor.next (https://deno.land/x/mongo@v0.25.0/src/protocol/cursor.ts:47:27)
    at async CommandCursor.[Symbol.asyncIterator] (https://deno.land/x/mongo@v0.25.0/src/protocol/cursor.ts:67:18)
    at async Database.listCollectionNames (https://deno.land/x/mongo@v0.25.0/src/database.ts:75:22)
    at async ReactiveCore (file:///C:/Users/User/Desktop/reactivedb/src/core/mod.ts:63:28)
    at async file:///C:/Users/User/Desktop/reactivedb/main.ts:1:40

image

@buttercubz
Copy link
Contributor Author

buttercubz commented Sep 5, 2021

ok I think I found it, apparently the batchSize field is no longer needed in the listCollections command in my local copy, removing this field made it work

https://github.com/denodrivers/deno_mongo/blob/588f1c500a210ec6feabc61eab13c0bb36669e65/src/database.ts#L50

https://docs.mongodb.com/v4.4/reference/command/listCollections/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants