mongoolia
mongoolia copied to clipboard
TypeError: TagSchema.syncWithAlgolia is not a function
Hey everyone,
I want to use mongoolia to sync my MongoDB with Algolia but am currently facing this bug when running the code:
TypeError: TagSchema.syncWithAlgolia is not a function
This is my code so far:
//meme schema
var meme = require('../app/model/meme');
var mongoose = require('mongoose');
const mongoolia = require('mongoolia').default;
var algoliasearch = require('algoliasearch');
const TagSchema = mongoose.Schema({
tagarray: { type: String, required: true, algoliaIndex: true },
});
TagSchema.plugin(mongoolia, {
appId: 'Qfdgdfgdf',
apiKey: 'd93fdgdfgffg',
indexName: 'test1'
})
TagSchema.syncWithAlgolia();
What am I doing wrong?
I was referred here by the algolia support team so hopefully, I get my problem solved here.
Thanks.
Hi, i have the same issue, did you find the problem? thanks.
Hey, sorry for not getting back yet. It would be a lot easier to debug if you made a setup which consistently fails? Thanks
Hey @aazcast, I have dropped mongoolia and go with the out of the box solution offered by Algolia. You can check here: for the setup.
Btw, thanks for the response @Haroenv
The syncWithAlgolia()
function is meant to be called at the Model level, not the ModelSchema level.
Try calling
const Tag = mongoose.model("Tag", TagSchema)
and then
Tag.syncWithAlgolia();
Hey @aazcast, I have dropped mongoolia and go with the out of the box solution offered by Algolia. You can check here: for the setup.
Btw, thanks for the response @Haroenv
Hey @Haroenv can you share the link ? I have been trying to work with mongoolia but nothing seems to be working for me.
Sorry @BhushanJoshi93, I don't have any link. Can you show a failing repository please?