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
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
$search operator (aggregation) is not correctly typed (for the highlight option). For example
import {Model, model, Schema} from "mongoose"; interface IUser { name: string; firstName: string; search(query: string): any; } // 2. Create a Schema corresponding to the document interface. const schema = new Schema<IUser>({ firstName: { type: String, required: true }, name: { type: String, required: true }, }); schema.static("search", function(this: Model<IUser>, query: string) { return this.aggregate([ { $search: { highlight: { path : ["name", "firstname"], // "name" works fine }, index: "searchLucene", text: { path: ["name", "firstname"], query, }, }, }, { $project: { firstName: 1, highlights: { $meta: "searchHighlights" }, name: 1, score: { $meta: "searchScore" }, }}, ]); }); // 3. Create a Model. const UserModel = model<IUser>("User", schema);
throws a compilation error (path should be a string not string[]).
If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
From MongoDB documentation, "highlight.path" can be a string array. So highlight.path should be at least string | string []
highlight.path
string | string []
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
The text was updated successfully, but these errors were encountered:
Fixed in v6.2.2 with #11373
Sorry, something went wrong.
No branches or pull requests
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
$search operator (aggregation) is not correctly typed (for the highlight option). For example
throws a compilation error (path should be a string not string[]).
If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
From MongoDB documentation, "highlight.path" can be a string array.
So
highlight.path
should be at leaststring | string []
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
The text was updated successfully, but these errors were encountered: