-
-
Notifications
You must be signed in to change notification settings - Fork 96
Closed
Labels
Description
Hello, I encountered a bug with the newer versions of graphql-compose-mongoose.
I have this custom filter added to my findMany resolver:
.addFilterArg({
name: 'from',
type: GraphQLDate,
description: 'Appointment date should be after the provided date.',
query: (rawQuery: any, value: Date) => {
rawQuery.date = {
$gte: value,
...(rawQuery.date && typeof(rawQuery.date) != 'object'
? { $eq: rawQuery.date }
: (rawQuery.date ?? {}))
};
}
})
When using this filter, the mongo query should be like this (and was like this up to 9.0.0):
appointments.find({ date: { '$gte': new Date("Fri, 01 Jan 2021 23:00:00 GMT") }}, { limit: 100, projection: { _id: true, name: true }})
Now it is like this:
appointments.find({ from: new Date("Fri, 01 Jan 2021 23:00:00 GMT"), date: { '$gte': new Date("Fri, 01 Jan 2021 23:00:00 GMT") }}, { limit: 100, projection: { _id: true, name: true }})
Note the added from
field in the find query, that makes it return no document.
This bug has been introduced in 9.0.1, the faulty commit is probably this one 313ea1f
toverux, pescoboza and putuyoga