流星+;Mongodb全文搜索
我想通过索引在mongodb(3.0.1版)集合上实现全文搜索。在服务器端启动期间,我通过流星+;Mongodb全文搜索,mongodb,meteor,Mongodb,Meteor,我想通过索引在mongodb(3.0.1版)集合上实现全文搜索。在服务器端启动期间,我通过\u ensureINdex方法创建索引,然后手动验证其存在性(它存在)。然后,我构建了一个包含在Meteor.methods中的普通函数,它获取一些数据(即字符串)并在索引集合上实现搜索 mySearchFunction: function(data) { var res = MyCollection.find({$text: {$search: data } }); console.log
\u ensureINdex
方法创建索引,然后手动验证其存在性(它存在)。然后,我构建了一个包含在Meteor.methods中的普通函数,它获取一些数据(即字符串)并在索引集合上实现搜索
mySearchFunction: function(data) {
var res = MyCollection.find({$text: {$search: data } });
console.log(res);
return res;
}
然而,日志显示了这个相当详细的错误
I20150322-11:57:49.976(-4)? _oplogHandle: null,
I20150322-11:57:49.976(-4)? db:
I20150322-11:57:49.976(-4)? { domain: null,
I20150322-11:57:49.976(-4)? _events: {},
I20150322-11:57:49.976(-4)? _maxListeners: 10,
I20150322-11:57:49.976(-4)? databaseName: 'meteor',
I20150322-11:57:49.976(-4)? serverConfig: [Object],
I20150322-11:57:49.976(-4)? options: [Object],
I20150322-11:57:49.976(-4)? _applicationClosed: false,
I20150322-11:57:49.976(-4)? slaveOk: false,
I20150322-11:57:49.976(-4)? bufferMaxEntries: -1,
I20150322-11:57:49.976(-4)? native_parser: false,
I20150322-11:57:49.976(-4)? bsonLib: [Object],
I20150322-11:57:49.976(-4)? bson: [Object],
I20150322-11:57:49.976(-4)? bson_deserializer: [Object],
I20150322-11:57:49.976(-4)? bson_serializer: [Object],
I20150322-11:57:49.976(-4)? _state: 'connected',
I20150322-11:57:49.977(-4)? pkFactory: [Object],
I20150322-11:57:49.977(-4)? forceServerObjectId: false,
I20150322-11:57:49.977(-4)? safe: false,
I20150322-11:57:49.977(-4)? notReplied: {},
I20150322-11:57:49.977(-4)? isInitializing: true,
I20150322-11:57:49.977(-4)? openCalled: true,
I20150322-11:57:49.977(-4)? commands: [],
I20150322-11:57:49.977(-4)? logger: [Object],
I20150322-11:57:49.977(-4)? tag: 1427039797274,
I20150322-11:57:49.977(-4)? eventHandlers: [Object],
I20150322-11:57:49.977(-4)? serializeFunctions: false,
I20150322-11:57:49.977(-4)? raw: false,
I20150322-11:57:49.977(-4)? recordQueryStats: false,
I20150322-11:57:49.977(-4)? retryMiliSeconds: 1000,
I20150322-11:57:49.977(-4)? numberOfRetries: 60,
I20150322-11:57:49.977(-4)? readPreference: [Object] },
I20150322-11:57:49.977(-4)? _primary: null },
I20150322-11:57:49.977(-4)? _cursorDescription:
I20150322-11:57:49.978(-4)? { collectionName: 'myCollection',
I20150322-11:57:49.978(-4)? selector: { '$text': [Object] },
I20150322-11:57:49.978(-4)? options: { transform: null } },
I20150322-11:57:49.978(-4)? _synchronousCursor: null }
I20150322-11:57:49.981(-4)? Internal exception while processing message { msg: 'method',
I20150322-11:57:49.981(-4)? method: 'myIndexMethod',
I20150322-11:57:49.982(-4)? params: [ 'someString' ],
I20150322-11:57:49.982(-4)? id: '10' } Maximum call stack size exceeded undefined
console.log(res.fetch())将返回一个数组,您不会从返回的游标中读取太多堆栈跟踪引用的是
myIndexMethod
,也许您应该将此方法添加到问题描述中?也许将您的实现与本文底部引用的示例进行比较会有所帮助?嘿,谢谢您的建议。我设法找出了错误,并让错误停止,我现在正遭受着一个不同的问题。。。