-
Notifications
You must be signed in to change notification settings - Fork 85
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
Engine warning and timeout #83
Comments
Same error here ... And the "migration" collection is created so the connection is OK |
Had the same issue today. It was because migrate-mongoose script wanted to access schemas before it connected to the DB. For me, adding mongoose.connect(MONGO_URI); at top of the migration script helped. |
Yep @dominikmch , i have used this same workaround. But i must add it on every migration scripts :/ Like this : async function up() {
await connectDB();
await asyncForEach(users, async (user) => {
await User.create({
...user,
token: token(),
origin: 'migrationScript',
});
});
}
/**
* Make any changes that UNDO the up function side effects here (if possible)
*/
async function down() {
await connectDB();
// Write migration here
await User.deleteMany({ origin: 'migrationScript' });
} I noticed that only happen with import use, i have antoher project with only require and i dont have this issue. |
@balmasi, could we add the |
This happens when you pull User directly from you user.model.js file, use the index.js example as in the setup documentation and pull User from there, this makes a db connection before trying to do anything. Will work `const {User} = require('../database/models/index.js') /**
/**
} module.exports = { up, down };` |
useUnifiedTopology seems to be deprecated https://www.mongodb.com/community/forums/t/mongodb-nodejs-driver-6-0-0-released/241691#usenewurlparser-and-useunifiedtopology-emit-deprecation-warnings-16 |
This is my first time trying to use this library. Since we don't handle the connection ourselves I'm not sure how to fix the warning. And I have no idea as to why my simple find() operation is timing out. The migration table was created just fine within the collection.
I've set MIGRATE_dbConnectionUri=mongodb://mongodb:27017/diageo
The text was updated successfully, but these errors were encountered: