Automattic / mongoose

MongoDB object modeling designed to work in an asynchronous environment.
https://mongoosejs.com
MIT License
26.97k stars 3.84k forks source link

MongoParserError: Expected retryWrites to be stringified boolean but got true #11134

Closed Fasunle closed 2 years ago

Fasunle commented 2 years ago

version 6.1.3 Do you want to request a feature or report a bug? bug What is the current behavior? MongoParserError: Expected retryWrites to return a stringified Boolean but got true If the current behavior is a bug, please provide the steps to reproduce.

[x] try to connect with the database using the connection string: mongodb+srv://:@sandbox.qnvqb.mongodb.net/myFirstDatabase?retryWrites=true&w=majority

![Uploading server-mongo.png…]()

What is the expected behavior? server-mongo-error

What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version. node 14.17.6 mongoose 6.1.3 mongodb 4.4.10

Fasunle commented 2 years ago

server-mongo

I checked online but the responses I saw couldn't solve the problem.

When I remove the retryWrites=true& w=majority, the connection was successful. But I feel like I have turned the functionality of retryWrites off. This is definitely a bug!

vkarpov15 commented 2 years ago

Make sure you don't have any typos in your connection string. Given that you typo-ed in this comment, the most likely explanation is that you have an errant space after true:

  await mongoose.connect('mongodb://localhost:27017/test?retryWrites=true &w=majority'); // Throws "Expected retryWrites to be stringified boolean value, got: true"
github-actions[bot] commented 2 years ago

This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] commented 2 years ago

This issue was closed because it has been inactive for 19 days since being marked as stale.