Meteor + Mongodb全文搜索

时间:2015-03-22 16:07:19

标签: mongodb meteor

我想通过索引在mongodb(版本3.0.1)集合上实现全文搜索。我在服务器端启动期间通过_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

0 个答案:

没有答案