Skip to content
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

Timeout when using mongoose-id-validator #40

Open
oliviervanbulck opened this issue Jan 18, 2021 · 2 comments
Open

Timeout when using mongoose-id-validator #40

oliviervanbulck opened this issue Jan 18, 2021 · 2 comments

Comments

@oliviervanbulck
Copy link

I'm trying to implement mongoose-id-validator in a NestJS project. When I do, the creation of the object gives me a timeout of more than 5 seconds, both when the IDs are valid and when they are not valid.

import * as idValidator from 'mongoose-id-validator';

EventSchema.plugin(idValidator);

{type: [mongoose.Schema.Types.ObjectId], required: true, ref: 'User'}

@hasanraza24
Copy link

facing the same issue with nextjs

@Davies-Owen
Copy link

Davies-Owen commented Feb 15, 2022

I ran into this issue but was able to solve it. I was using a non-default mongoose connection, and hadn't passed the connection to mongoose-id-validator. I fixed it by passing the non-default connection into the plugin options:

mySchema.plugin(mongoose_id_validator, {
  connection: myNonDefaultConnection,
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants