These are chat archives for Automattic/mongoose

5th
Oct 2015
Valeri Karpov
@vkarpov15
Oct 05 2015 00:07
@uptownhr thanks :)
@drakoumel mongoose should be fine with SCRAM-SHA-1, the underlying mongodb driver should handle that properly
Chris
@drakoumel
Oct 05 2015 07:27
@vkarpov15 I am currently using: "mongoose": "^4.1.9” and after mongolabs updated their mongodb version to MongoDB 3.0.x I am getting an authentication error: MongoError: Authentication failed. Although the same connection used to work before mongolabs upgraded from 2.6
@vkarpov15 btw thnx for the reply
Chris
@drakoumel
Oct 05 2015 09:02
I have contacted monoglabs to see if there is any issue on their end
Valeri Karpov
@vkarpov15
Oct 05 2015 14:12
Hmm that's unexpected. You might want to try explicitly setting the authentication mechanism in the connection string, mongodb://user:pass@host:port/db?authMechanism=SCRAM-SHA-1 or mongodb://user:pass@host:port/db?authMechanism=MONGODB-CR. Upgrading to mongodb 3.0.x is not sufficient to change over to SCRAM-SHA-1 auth if you already have users in the database, that usually ends up being the source of these errors @drakoumel
Chris
@drakoumel
Oct 05 2015 14:50
@vkarpov15 both have failed with same error. I will wait for mongolabs to post a reply
Valeri Karpov
@vkarpov15
Oct 05 2015 17:21
I'd ask them if your users have been upgraded to use SCRAM-SHA-1 or not, that's pretty important
either way, let me know what you figure out
Chris
@drakoumel
Oct 05 2015 17:24
@vkarpov15 will let you know.
Valeri Karpov
@vkarpov15
Oct 05 2015 17:24
@JohnRodney for future reference, mongoose now has compatibility guide in docs: http://mongoosejs.com/docs/compatibility.html
Chris
@drakoumel
Oct 05 2015 18:16
@vkarpov15 thnx for the link I was actually looking for it.
Btw I was using the wrong uri when I tested ?authMechanism=SCRAM-SHA-1. using the correct credentials it works fine. Why do we need to explicitly mention the authMechanism?
And yes the users have been upgraded to SCRAM-SHA-1
agorem
@agorem
Oct 05 2015 18:22
Sorry, I'm newbie using Mongoose. I am trying to insert a user document using the document save method and I have a pre save hook defined in the Schema.
The pre save callback function is not fired before the save, although I see the function registered in the document doc.pres.save array.
Any suggestion?. Thanks
Valeri Karpov
@vkarpov15
Oct 05 2015 19:04
@drakoumel it should work in theory if you don't specify authMechanism=SCRAM-SHA-1, here's the relevant code: https://github.com/christkv/mongodb-core/blob/75a9259f746c75a651cfd31430122893ed21f1ec/lib/topologies/server.js#L1018-L1021 basically, if you're connecting to a mongodb instance that's >= 3.0.0 it should use SCRAM-SHA-1 by default. Can you show me how you're connecting?
@agorem show your code please :) hard to translate english to JavaScript
agorem
@agorem
Oct 05 2015 19:08
@vkarpov15 ;) I have found my problem. A validation field rule fires an error although I haven't implemented the validation method. Thanks