These are chat archives for Automattic/mongoose

21st
Mar 2018
Kev
@lineus
Mar 21 2018 00:47
@steadysupply I'll have to check to make sure, but I don't see { useMongoClient: true } in that gist, so I have to assume 5.x
Kev
@lineus
Mar 21 2018 00:57
@steadysupply yeah, that works on 5.x, I haven't tested it on 4. Which version are you using?
steadysupply
@steadysupply
Mar 21 2018 00:59
they are on 4.10
Kev
@lineus
Mar 21 2018 00:59
ok, give me a couple minutes and I'll see what if anything needs to change for 4
steadysupply
@steadysupply
Mar 21 2018 01:00
i've implemented outside schema.methods just using a free function and don't think i'll go back and change it now
sure, i'd be interested to see :)
Kev
@lineus
Mar 21 2018 01:00
yeah, I'm curious now too. I've never messed with plugins before so this was interesting
it works on mongoose 4.13.11 :)
just had to add the Promise and useMongoClient stuff for 4
Kev
@lineus
Mar 21 2018 01:10
oh, and I moved the connection.close() to a more sane place, but that might have been something I borked after I upload the gist. I think I kept playing with it some afterwards :)
Casey_1991
@casey1991
Mar 21 2018 07:11
hello, modal.pre('update',function(next)) not call
Sedric Heidarizarei
@saeedhei
Mar 21 2018 08:54
@lineus I'm using a chat app with mongoose, I don't want to close my connection because other query not work. Can I use That script for closing and opening connection for 1 time per week? Is a good idea for me?
Kev
@lineus
Mar 21 2018 09:01
@saeedhei yeah, leave it up :)
Kev
@lineus
Mar 21 2018 09:09
@casey1991 can you make a gist of your code that shows where you define your schema, Model, and pre update hook?
if you're not familiar with gist, go here
Sedric Heidarizarei
@saeedhei
Mar 21 2018 16:20
@lineus thanks, I will leave it๐Ÿ‘