mongoose-text-search is not working

91 views
Skip to first unread message

jati...@ykone.com

unread,
Apr 14, 2016, 5:43:13 AM4/14/16
to Mongoose Node.JS ODM

I have a already built old project on nodejs where I am using MongoDb to store data. Mongodb version is 2.4

The problem is I am running a text-search on a collection but it's never return anything which means console.log(arguments); never get print anything

It's to inform you guys that I am able to run db.socialposts.runCommand( "text", { search: "accessories",limit: 1 } ) on mongo terminal and getting results very fast

var options, search;

options = {
  limit: 1
};

search = 'accessories';

console.log(search);

SocialPost.textSearch(search, options, function(err, out) {
 console.log(arguments);
 return true;
});

schema = new mongoose.Schema({ entity_id: { type: mongoose.Schema.Types.ObjectId, required: true }, social_id: { type: String, required: true }, type: { type: String, required: true }, app: { type: String, required: true }, date: { type: Date, required: true }, url: { type: String, required: true }, post: { type: String }, title: { type: String }, image: { type: String }, video: { type: String }, hashtags: [String] }, { strict: 'throw' });

schema.index({ type: 1, social_id: 1 }); schema.index({ type: 1, entity_id: 1, date: 1 }); schema.index({ title: 'text', post: 'text' });

jati...@ykone.com

unread,
Apr 14, 2016, 5:45:16 AM4/14/16
to Mongoose Node.JS ODM

Thomas Blobaum

unread,
Apr 14, 2016, 12:22:29 PM4/14/16
to mongoo...@googlegroups.com
--
Documentation - http://mongoosejs.com/
Plugins - http://plugins.mongoosejs.com/
Bug Reports - http://github.com/learnboost/mongoose
Production Examples - http://mongoosejs.tumblr.com/
StackOverflow - http://stackoverflow.com/questions/tagged/mongoose
Google Groups - https://groups.google.com/forum/?fromgroups#!forum/mongoose-orm
Twitter - https://twitter.com/mongoosejs
IRC - #mongoosejs
---
You received this message because you are subscribed to the Google Groups "Mongoose Node.JS ODM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongoose-orm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages