We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The code works but type show as error at $options
Argument of type '{ $or: ({ username: { $regex: string; $options: string; }; } | { name: { $regex: string; $options: string; }; })[]; } | {}' is not assignable to parameter of type 'Filter<{ provider?: ("google" | "facebook" | "discord" | "email")[] | undefined; devId?: string | ObjectId | undefined; discordId?: string | undefined; avatar?: string | undefined; ... 20 more ...; apps: (string | ObjectId)[]; }> | undefined'. Type '{ $or: ({ username: { $regex: string; $options: string; }; } | { name: { $regex: string; $options: string; }; })[]; }' is not assignable to type 'Filter<{ provider?: ("google" | "facebook" | "discord" | "email")[] | undefined; devId?: string | ObjectId | undefined; discordId?: string | undefined; avatar?: string | undefined; ... 20 more ...; apps: (string | ObjectId)[]; }>'. Types of property '$or' are incompatible. Type '({ username: { $regex: string; $options: string; }; } | { name: { $regex: string; $options: string; }; })[]' is not assignable to type 'Filter<{ provider?: ("google" | "facebook" | "discord" | "email")[] | undefined; devId?: string | ObjectId | undefined; discordId?: string | undefined; avatar?: string | undefined; ... 20 more ...; apps: (string | ObjectId)[]; }>[]'. Type '{ username: { $regex: string; $options: string; }; } | { name: { $regex: string; $options: string; }; }' is not assignable to type 'Filter<{ provider?: ("google" | "facebook" | "discord" | "email")[] | undefined; devId?: string | ObjectId | undefined; discordId?: string | undefined; avatar?: string | undefined; ... 20 more ...; apps: (string | ObjectId)[]; }>'. Type '{ username: { $regex: string; $options: string; }; }' is not assignable to type 'Filter<{ provider?: ("google" | "facebook" | "discord" | "email")[] | undefined; devId?: string | ObjectId | undefined; discordId?: string | undefined; avatar?: string | undefined; ... 20 more ...; apps: (string | ObjectId)[]; }>'. Types of property 'username' are incompatible. Type '{ $regex: string; $options: string; }' is not assignable to type 'string | FilterOperators<string> | undefined'. Object literal may only specify known properties, and '$options' does not exist in type 'FilterOperators<string>'.deno-ts(2345)
const users = await Users.find( search ? { $or: [ { username: { $regex: search, $options: "i" } }, // 'i' for case-insensitive { name: { $regex: search, $options: "i" } }, ], } : {}, { projection: { password: 0 }, } ).toArray();
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The code works but type show as error at $options
The text was updated successfully, but these errors were encountered: