New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gtfs.getStops() throws Mongoose DeprecationWarning #82
Comments
This happens when your project has mongoose installed twice - once as a
dependency of your project and once as a dependency of node-gtfs.
Is mongoose specified as a dependency of your project in package.json or is
it installed globally?
…On Fri, Nov 3, 2017 at 2:18 AM Jiri Matyas ***@***.***> wrote:
Hi, I tried creating a simple example that would download my local
agency's timetables and just print the available stops to console. I set
mongoose.promise in my code, but still get a warning when I call
gtfs.getStops(). My code is:
const config = require('./config.json');
const gtfs = require('gtfs');
var mongo = require('mongodb');
var mongoose = require('mongoose');
mongoose.Promise = global.Promise;
mongoose.connect(config.mongoUrl, {useMongoClient: true}).then(function() {
console.log('connected')
gtfs.getStops({
agency_key: 'dpp'
})
.then(stops => {
console.log(stops);
});
}).catch(err => console.log(err));
config.json:
{
"mongoUrl": "mongodb://localhost:27017/gtfs",
"agencies": [
{
"agency_key": "dpp",
"url": "http://opendata.iprpraha.cz/DPP/JR/jrdata.zip"
}
]
}
I am using mongoose 4.11.8 and I ran gtfs.import and it reported no
errors, and I did not find any problems in the db either. I found this
issue <Automattic/mongoose#4951> on mongoose
github and it seems there is a workaround, but it would require inserting
mongoose.promise = global.Promise
into almost every file that accesses the db, including gtfs files. Have
you encountered this issue before or do you have any more feasible
workaround?
Thanks
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#82>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAF32fczcPM6DFh8XhlkDg9k-IjxNLY8ks5sysxOgaJpZM4QQxAB>
.
|
Thanks, that helped! It was specified as a dependency in my package.json. I removed it, reinstalled node_modules and now it works fine. The only slight issue is, that when I want to access mongoose in my project, I have to require the one installed as a dependency of node-gtfs. Like this: |
It is ok to specify it as a dependency in your project as long as you
specify the exact same version as node-GTFS and don’t use ^ or ~ in front
of it. Then, delete node_modules and npm install. NPM should realize that
it only needs to install one copy of mongoose.
…On Fri, Nov 3, 2017 at 05:17 Jiri Matyas ***@***.***> wrote:
Thanks, that helped!
It was specified as a dependency in my package.json. I removed it,
reinstalled node_modules and now it works fine.
The only slight issue is, that when I want to access mongoose in my
project, I have to require the one installed as a dependency of node-gtfs.
Like this:
const mongoose = require('./node_modules/gtfs/node_modules/mongoose');
Is there a nicer way to do that?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#82 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAF32ck_ilCpzDXiu4iIWIsq9041t0ZDks5syvZJgaJpZM4QQxAB>
.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I tried creating a simple example that would download my local agency's timetables and just print the available stops to console. I set mongoose.promise in my code, but still get a warning when I call gtfs.getStops(). My code is:
config.json:
I am using mongoose 4.11.8 and I ran gtfs.import and it reported no errors, and I did not find any problems in the db either. I found this issue on mongoose github and it seems there is a workaround, but it would require inserting
mongoose.promise = global.Promise
into almost every file that accesses the db, including gtfs files. Have you encountered this issue before or do you have any more feasible workaround?
Thanks
The text was updated successfully, but these errors were encountered: