Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js MongoDB sort使用的内存超过了最大内存,但是否使用了索引?_Node.js_Mongodb_Mongoose - Fatal编程技术网

Node.js MongoDB sort使用的内存超过了最大内存,但是否使用了索引?

Node.js MongoDB sort使用的内存超过了最大内存,但是否使用了索引?,node.js,mongodb,mongoose,Node.js,Mongodb,Mongoose,我正在调试一个带有分页结果的站点搜索功能,该功能在任意数量的页面后失败 search: Executor error during find command: OperationFailed: Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit. 但是,我相信它使用的是一个索引: winningPlan: { stage:

我正在调试一个带有分页结果的站点搜索功能,该功能在任意数量的页面后失败

search: Executor error during find command: OperationFailed: Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit.
但是,我相信它使用的是一个索引:

   winningPlan:
    { stage: 'PROJECTION',
      transformBy:
       { score: { '$meta': 'textScore' },
         shootId: 1,
         title: 1,
         publishDate: 1,
         'media.images.indexImage': 1,
         'media.images.adImage': 1,
         'media.images.galleryImages': 1,
         'media.images.portrait': 1,
         'media.promos.images.410': 1,
         'media.full.full.length': 1,
         contentProducer: 1,
         performers: 1,
         site: 1 },
      inputStage:
       { stage: 'TEXT',
         indexPrefix: {},
         indexName: 'textSearchIndex',
         parsedTextQuery:
          { terms: [ 'milk' ],
            negatedTerms: [],
            phrases: [],
            negatedPhrases: [] },
         textIndexVersion: 3,
         inputStage:
          { stage: 'TEXT_MATCH',
            inputStage:
             { stage: 'TEXT_OR',
               filter:
                { '$and':
                   [ { 'status.publishStatus': { '$eq': 'PUBLISHED' } },
                     { publishDate: { '$lte': 2017-03-17T21:30:29.254Z } } ] },
               inputStage:
                { stage: 'IXSCAN',
                  keyPattern:
                   { _fts: 'text',
                     _ftsx: 1,
                     'status.publishStatus': 1,
                     publishDate: -1 },
                  indexName: 'textSearchIndex',
                  isMultiKey: true,
                  isUnique: false,
                  isSparse: false,
                  isPartial: false,
                  indexVersion: 2,
                  direction: 'backward',
                  indexBounds: {} } } } } },
   rejectedPlans: [] },
该集合约为1gb,35k个对象,平均大小为28.3KB

索引为22.8 MiB:

{ 
    "description" : "text", 
    "performers.performerName" : "text", 
    "site.shortName" : "text", 
    "summary" : "text", 
    "title" : "text", 
    "status.publishStatus" : 1, 
    "publishDate" : -1
}
查询:

{
  'status.publishStatus': 'PUBLISHED',
  'publishDate': {
    '$lte': new Date("Fri, 17 Mar 2017 21:30:29 GMT")
  },
  '$text': {
      '$search': 'milk'
  }
}
分类:

{
  score: {
    $meta: 'textScore'
  },
  publishDate: -1
}
实际上,它是在进行查找、排序、跳过、限制、精简、选择和最终执行

它真的被索引了吗?如果不是,我该怎么做

如果它被索引,我应该增加internalQueryExecMaxBlockingSortBytes吗