-
Notifications
You must be signed in to change notification settings - Fork 50
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
How to handle nested field? The Anagram is not created under info.name1 #78
Comments
According to the documentation you need to use |
I used keys: const mongoose = require('mongoose'); const taskSchema = new mongoose.Schema({ taskSchema.plugin( mongoose_fuzzy_searching, { module.exports = mongoose.model('Task', taskSchema); Saved it: addNewTask = async () => { but still anagrams are not getting saved to mongo: Mongoose: tasks.insertOne({ _id: ObjectId("5fb326440deaa5357845fa8b"), name: 'Army1 of Ants', info: { name1: 'Army1 Ants1', title: 'Army1 Ants2', version: 'Army1 Ants3', description: 'Army1 Ants4' }, completed: false, user: ObjectId("5f91caa051fa0512993e9326"), info_fuzzy: [ { name1_fuzzy: [ 'y1', 'my', 'rm', 'ar', 'my1', 'rmy', 'arm', 'rmy1', 'army', 'army1', 's1', 'ts', 'nt', 'an', 'ts1', 'nts', 'ant', 'nts1', 'ants', 'ants1', 'army1 ants1' ], title_fuzzy: [ 'y1', 'my', 'rm', 'ar', 'my1', 'rmy', 'arm', 'rmy1', 'army', 'army1', 's2', 'ts', 'nt', 'an', 'ts2', 'nts', 'ant', 'nts2', 'ants', 'ants2', 'army1 ants2' ], version_fuzzy: [ 'y1', 'my', 'rm', 'ar', 'my1', 'rmy', 'arm', 'rmy1', 'army', 'army1', 's3', 'ts', 'nt', 'an', 'ts3', 'nts', 'ant', 'nts3', 'ants', 'ants3', 'army1 ants3' ], description_fuzzy: [ 'y1', 'my', 'rm', 'ar', 'my1', 'rmy', 'arm', 'rmy1', 'army', 'army1', 's4', 'ts', 'nt', 'an', 'ts4', 'nts', 'ant', 'nts4', 'ants', 'ants4', 'army1 ants4' ] } ], createdAt: new Date("Tue, 17 Nov 2020 01:24:20 GMT"), updatedAt: new Date("Tue, 17 Nov 2020 01:24:20 GMT"), __v: 0 }, { session: null }) |
NVM, it worked this time: Thanks for the response. Good night. {"_id":{"$oid":"5fb3286e8b01a735eb82f5dc"},"name":"Army1 of Ants","info":{"name1":"Army1 Ants1","title":"Army1 Ants2","version":"Army1 Ants3","description":"Army1 Ants4"},"completed":false,"user":{"$oid":"5f91caa051fa0512993e9326"},"info_fuzzy":[{"name1_fuzzy":["y1","my","rm","ar","my1","rmy","arm","rmy1","army","army1","s1","ts","nt","an","ts1","nts","ant","nts1","ants","ants1","army1 ants1"],"title_fuzzy":["y1","my","rm","ar","my1","rmy","arm","rmy1","army","army1","s2","ts","nt","an","ts2","nts","ant","nts2","ants","ants2","army1 ants2"],"version_fuzzy":["y1","my","rm","ar","my1","rmy","arm","rmy1","army","army1","s3","ts","nt","an","ts3","nts","ant","nts3","ants","ants3","army1 ants3"],"description_fuzzy":["y1","my","rm","ar","my1","rmy","arm","rmy1","army","army1","s4","ts","nt","an","ts4","nts","ant","nts4","ants","ants4","army1 ants4"]}],"createdAt":{"$date":"2020-11-17T01:33:34.923Z"},"updatedAt":{"$date":"2020-11-17T01:33:34.923Z"},"__v":0} |
It looks like the old key indexes needs to be dropped when you change keys. |
Yes indeed. I'm currently working on deleting the indexes every time. |
Do you know when you plan on releasing an update? Should the index expire so that it can be rebuilt? |
I think we can expire only date indexes. The ideal scenario is every time you restart your application to delete manually the indexes. I will try to delete them when the plugin is initialized. |
My model looks like this:
I saved :
The Anagram is not created under info.name1:
name1_fuzzy is empty.
The text was updated successfully, but these errors were encountered: