Skip to content
New issue

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

Search not working with object data #99

Open
himanshutecstub opened this issue Dec 21, 2021 · 0 comments
Open

Search not working with object data #99

himanshutecstub opened this issue Dec 21, 2021 · 0 comments

Comments

@himanshutecstub
Copy link

himanshutecstub commented Dec 21, 2021

Do you want to request a feature, an issue, or report a bug?
Yes

What is the current behaviour?
Can't search with index and object data

If the current behaviour is a bug, please provide the steps to reproduce.
I create user Schema with fuzzy search plugin as below

const UserSchema = new Schema({
  name: {
    firstName: String,
    lastName: String
  },
  email: String
},{timestamps: true});
UserSchema.index({"$**": "text"});
UserSchema.plugin(mongoose_fuzzy_searching, { fields: ['name.firstName', 'name.lastName', 'email'] });
const User = mongoose.model('User', UserSchema);

When try to search with firstname or last name it's return no results while already have results
User.fuzzySearch({query: 'jo'}).sort({ age: -1 }).exec();
Also check in mongoose database email_fuzzy have data but firstName_fuzzy haven't data

What is the expected behaviour?
Return results when add data as new User({ email : "[email protected]",name : {firstName: 'John A', lastName: 'Deo'}});
If this is a feature request, what is the motivation or use case for changing
the behaviour?

No
Please mention other relevant information such as Node.js and mongoose version.
Node : 16.6.2
Mongoose : 5.10.19

@himanshutecstub himanshutecstub changed the title Search not working with Search not working with object data Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant