Closed jake-billings closed 6 years ago
Oh yeah. I added getCollection (the only function in the file which needs the user's version of mongoose) to gen.utils on the last release and forgot to change the mongoose source. Good catch. Feel free to open a PR
Pull request sent. See issue #48.
From: Emmanuel Olaojo notifications@github.com Reply-To: e-oj/Fawn reply@reply.github.com Date: Wednesday, January 24, 2018 at 5:09 PM To: e-oj/Fawn Fawn@noreply.github.com Cc: Jake Billings jake@jakebillings.com, Author author@noreply.github.com Subject: Re: [e-oj/Fawn] gen.utils.js uses require("mongoose") instead of the mongoose from Fawn.init (#46)
Oh yeah. I added getCollection, the only function in the file which needs mongoose, to gen.utils on the last release and forgot to change to mongoose source. Good catch. Feel free to open a PR
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Open the pr on dev and I'll merge it. Solid work 👌
I'm not super familiar with the structure of this repository. I'll create a pull request if I find some free time and you guys agree with me.
I've had a lot of trouble getting Fawn to work because in some places it uses the statement "require("mongoose")"
By default, npm does not install the same version of mongoose as Fawn. As a result, an additional copy of mongoose is cloned into node_modules/fawn/node_modules/mongoose.
When fawn calls "require("mongoose")" node loads this separate instance of mongoose. As a result, none of the mongoose models I have defined are registered. This results in errors when I try to run transactions.
My current workaround is to manually check the version of mongoose Fawn uses (4.11.3) and lock my project to the same one. This is not ideal for my dev environment, but it does work.
I believe that using the copy of mongoose from Fawn.init throughout the entirety of Fawn would fix this issue.
gen.utils.js is the source of the error I encountered, and the file uses require() to load mongoose. I haven't checked if require() is used to load mongoose anywhere else.