Open freitzzz opened 4 years ago
Would you like to create a PR? regarding the default ssl option, I don’t think it should be set to true by default, because of backwards compatability
Would you like to create a PR? regarding the default ssl option, I don’t think it should be set to true by default, because of backwards compatability
Hi @adrai thanks for the quick response! I don't mind updating the documentation! However I'm currently on full work + education schedule and can't contribute, unfortunately. If I manage to have some time and nobody started working on this, I will make sure to update the issue to refer that I will update the documentation. Regarding backwards compatability, do you mind explaining a little better? I'm not used to the term so I can't seem to figure out the case here.
If we would change the defaults, which currently are:
{
host: 'localhost',
port: 27017,
dbName: 'eventstore',
eventsCollectionName: 'events',
snapshotsCollectionName: 'snapshots',
transactionsCollectionName: 'transactions'//,
// heartbeat: 60 * 1000
};
var defaultOpt = {
ssl: false
};
and most of the users of this library use some sort of local network connection to the mongodb server, without any ssl; this would break their code... This is why I would suggest to not change the defaults.
If we would change the defaults, which currently are:
{ host: 'localhost', port: 27017, dbName: 'eventstore', eventsCollectionName: 'events', snapshotsCollectionName: 'snapshots', transactionsCollectionName: 'transactions'//, // heartbeat: 60 * 1000 }; var defaultOpt = { ssl: false };
and most of the users of this library use some sort of local network connection to the mongodb server, without any ssl; this would break their code... This is why I would suggest to not change the defaults.
Oh I see, makes sense. Thanks for the explanation!
@freitzzz were you ever able to get this to connect to mongo atlas? When I run init()
it doesn't seem to properly establish a connection...
@freitzzz were you ever able to get this to connect to mongo atlas? When I run
init()
it doesn't seem to properly establish a connection...
yes @m-sterspace
want me to send a code snippet?
i don't think that changing the defaults is an option. you provide a connection string with all the options that you might need and this should work.The defaults are, as the name suggests, defaults for most users which will use a local mongo connection.
i don't think that changing the defaults is an option. you provide a connection string with all the options that you might need and this should work.The defaults are, as the name suggests, defaults for most users which will use a local mongo connection.
i dont think you can disable or enable SSL communication through the connection string
@freitzzz according to the mongodb docs you can - https://docs.mongodb.com/manual/reference/connection-string/#connection-options
@freitzzz according to the mongodb docs you can - https://docs.mongodb.com/manual/reference/connection-string/#connection-options
Didn't know about this, thank you
were you guys able to get this to work with mongo atlas? I'm struggling with some strange errors. my app seems to connect find, but when I try any query ie. getEventsByRevision, i get the following:
TypeError: Cannot read properties of undefined (reading 'find')
I've been using this package for a couple years with a mongo cluster I run in my own kubernetes cluster. I'm ready to give atlas a shot, but I'm having issues. Can anyone shed light on their config/settings to get this to work?
were you guys able to get this to work with mongo atlas? I'm struggling with some strange errors. my app seems to connect find, but when I try any query ie. getEventsByRevision, i get the following:
TypeError: Cannot read properties of undefined (reading 'find')
I've been using this package for a couple years with a mongo cluster I run in my own kubernetes cluster. I'm ready to give atlas a shot, but I'm having issues. Can anyone shed light on their config/settings to get this to work?
Mongo Atlas = Mongo Cloud, right? If so, yes. Below you can find the public sources for a university project where this issue was risen.
@freitzzz
Yes. And using that repo I was able to get mine working! Thanks!
for others who struggle with this. My changes were this:
1) Add ?retryWrites=true&w=majority
to the end of the mongo url
2) Add the following options
const eventStoreClient = eventstore({
type: 'mongodb',
url: config.MONGO_URL,
eventsCollectionName: 'events', // optional
snapshotsCollectionName: 'snapshots', // optional
transactionsCollectionName: 'transactions', // optional
timeout: 10000, // optional
options: {
ssl: true,
autoReconnect: false,
useNewUrlParser: true
}
});
This is what I added.
options: {
ssl: true,
autoReconnect: false,
useNewUrlParser: true
}
@freitzzz
Yes. And using that repo I was able to get mine working! Thanks!
for others who struggle with this. My changes were this:
- Add
?retryWrites=true&w=majority
to the end of the mongo url- Add the following options
const eventStoreClient = eventstore({ type: 'mongodb', url: config.MONGO_URL, eventsCollectionName: 'events', // optional snapshotsCollectionName: 'snapshots', // optional transactionsCollectionName: 'transactions', // optional timeout: 10000, // optional options: { ssl: true, autoReconnect: false, useNewUrlParser: true } });
This is what I added.
options: { ssl: true, autoReconnect: false, useNewUrlParser: true }
Glad to know it helped :)
Since
ssl
option is set to false, it is not possible to establish a connection to a MongoDB server using an ecrypted connection (e.g. MongoDB Atlas). This option is not even featured in how to connect to each database in README.md. It would be great if the documentation on how to get started is updated as well as defaulting ssl option to true.