rodrigogs / mongoose-timezone

Mongoose plugin to normalize stored dates timezone.
BSD 3-Clause "New" or "Revised" License
15 stars 6 forks source link

find with req.params not working #1

Closed matheusdavidson closed 5 years ago

matheusdavidson commented 7 years ago

A query that uses req.params stop working after using the plugin, for example:

Model.find({email: req.params.email}).exec()

The above query won't execute nothing, if i comment the plugin:

//userSchema.plugin(timeZone, { paths: ['passwordResetExpires'] });

It works again.

The issue happens only with req.params, if i hardcode the email there it works. I have consoled req.params and it has the email e it is a string.

daniel-van-niekerk commented 6 years ago

I also have this issue, is there a fix?

JonatanPotrikus commented 5 years ago

Problema ainda acontece. Alguma dica ?

yalcinmuhammed commented 5 years ago

I think problem is still going. I added to my schema this code. tokenSchema.plugin(timezone, { paths: ['createdAt', 'updatedAt', 'token.expiresAt'] }); And no response when i run this code

           TokenModel.findOne({"token.accessToken":accessToken}).then((instance)=>{
                if(instance){
                    return resolve(instance);
                }else{
                    return reject(new AuthError.UnauthorizedError());
                }
            }).catch((err)=>{
                logger.error(err);
                return reject(err);
            });
yalcinmuhammed commented 5 years ago

I have pull request about this issue. You guys can check and live for another day :) Check commit

rodrigogs commented 5 years ago

I had to discard your PR since your solution caused another bug.

Should be solved in https://github.com/rodrigogs/mongoose-timezone/releases/tag/v1.2.0