These are chat archives for Automattic/mongoose

14th
Oct 2016
Erinç Fırtına
@EricMcRay
Oct 14 2016 13:36

can someone explain me how Query#in method working?? Because it gaves me “CastError”

User.find().in(‘tags’, [2,5]).exec();
User.find().where(‘tags’).in([2,5]).exec();

I tried both. No success

Erinç Fırtına
@EricMcRay
Oct 14 2016 13:45
@phumberdroz did you try with object?
I sort it now with plain js
Erinç Fırtına
@EricMcRay
Oct 14 2016 13:55
I just checked your schema. It because “seasons” field is an array and you can’t sort docs by array field.
Varun Jayaraman
@varunjayaraman
Oct 14 2016 17:06
anyone know how to keep populated fields in a document when converting it to a mongoose document on the client?
it replaces populated fields with its _id when you run new mongoose.Document(pojo, Schema)