These are chat archives for Automattic/mongoose

17th
Aug 2018
mongoosebot
@mongoosebot
Aug 17 2018 13:11
:tada: We just released version 502: :tada:
502: Failure
Kev
@lineus
Aug 17 2018 13:12
womp womp womp BOT FAIL!
Keo
@Keo_Dara012_twitter
Aug 17 2018 15:38
how to we make enum default value
image.png
Keo
@Keo_Dara012_twitter
Aug 17 2018 15:54
DeprecationWarning: collection.find option [fields] is deprecated and will be removed in a later version
what is this
Kev
@lineus
Aug 17 2018 15:57
@Keo_Dara012_twitter
role: {
  type: String,
  enum: ['admin', 'buy', 'seller' ],
  default: 'buy'
}
@Keo_Dara012_twitter for your 2nd question, can you show your call to find, and your version of mongoose?
Knock East
@KnockEast_twitter
Aug 17 2018 18:18
Hi
Snehanshu Phukon
@pSnehanshu
Aug 17 2018 18:19
Hi @lineus
Kev
@lineus
Aug 17 2018 18:19
hey @pSnehanshu :)
thanks for joining
Snehanshu Phukon
@pSnehanshu
Aug 17 2018 18:19
Thanks for responding
Kev
@lineus
Aug 17 2018 18:20
I'm duplicating your connection example now, just need a minute.
anytime!
Snehanshu Phukon
@pSnehanshu
Aug 17 2018 18:21
sure
Kev
@lineus
Aug 17 2018 18:27
I'm able to reproduce what you're seeing
I think it's because the credentials are in the options instead of the uri string
if you pass them in the uri it works fine
Snehanshu Phukon
@pSnehanshu
Aug 17 2018 18:28
Why?
Kev
@lineus
Aug 17 2018 18:28
I'm working on that now
Snehanshu Phukon
@pSnehanshu
Aug 17 2018 18:28
Will it be fixed?
@lineus great
Kev
@lineus
Aug 17 2018 18:29
honestly, I've always used the srv string provided by atlas that had the credentials in it ( from the console ) so I never considered whether passing them in the options would work or not.
I'm going to write a script using the native driver alone next, just to completely rule out mongoose.
Snehanshu Phukon
@pSnehanshu
Aug 17 2018 18:30
Since there is an option to pass credentials through options, it should work in any way.
Snehanshu Phukon
@pSnehanshu
Aug 17 2018 18:41
DeprecationWarning: collection.find option [fields] is deprecated and will be removed in a later version
Facing same problem @Keo_Dara012_twitter
Kev
@lineus
Aug 17 2018 18:43
I was wrong, I had a typo in my atlas srv string. it was mongodb+srv://@cluster... I removed the @ and it works fine in both mongoose and the native driver directly.
when I removed the credentials from the uri, I left the @ behind
so it's not a native driver issue, this appears to be mongoose related.
Kev
@lineus
Aug 17 2018 19:10
@pSnehanshu for now, pass the credentials in the uri and I'll see if I can sort it out in Automattic/mongoose#6881
Snehanshu Phukon
@pSnehanshu
Aug 17 2018 19:13
Ok @lineus thanks
Kev
@lineus
Aug 17 2018 19:34
@pSnehanshu Sorry for the back and forth. I went over my native driver version of the script and realized I wasn't passing in the useNewUrlParser: trueoption. when I added that in, the native driver fails. This is exactly what mongoose is passing in.
I added a comment to the native driver bug with my script, they should be able to replicate it with that and fix it. For grins, I'll take a look at the native driver and see if I can put a PR in for it.
Snehanshu Phukon
@pSnehanshu
Aug 17 2018 19:46
Yeah, I knew somehow, from my guts, that the problem is with MongoDB driver, not Mongoose.
Kev
@lineus
Aug 17 2018 19:47
I hate to be the guy that throws things over the fence though, so I try my best to prove it. This time I made soooo many mistakes along the way. Not sure why, I guess I'm off my game today :smile:
Snehanshu Phukon
@pSnehanshu
Aug 17 2018 19:48
throws things over the fence
Not getting that phrase though
Kev
@lineus
Aug 17 2018 19:49
finds a problem and passes it off to someone else without trying to find a solution
I don't feel that way about all packages I use, but I have a sense of responsibility with mongoose that's probably absurd :imp:
Snehanshu Phukon
@pSnehanshu
Aug 17 2018 19:51
Haha, people that throws things over the fence are annoying.
For me, packages are black boxes, I wouldn't like to touch them. :D
Kev
@lineus
Aug 17 2018 19:52
that's how I feel about the native driver but I'm trying to fix it!
I thought it was cool that you opened an issue with them, that was really proactive :)
Snehanshu Phukon
@pSnehanshu
Aug 17 2018 19:53
Keep it up bro. Devs like you are saviours/messiah for devs like us.
:D My gut feeling. :D
Kev
@lineus
Aug 17 2018 20:13
Thanks @pSnehanshu :+1: