流星崩溃:MongoError:ns名称太长,最大大小为128

时间:2015-06-26 00:57:24

标签: mongodb meteor

我的Meteor应用程序在localhost上正常运行,但当我将其部署到myApp.meteor.com时,我收到以下错误。我很难理解这些错误日志。有什么想法吗?

[Thu Jun 25 2015 06:35:23 GMT+0000 (UTC)] 
WARNING /meteor/dev_bundles/0.4.18/lib/node_modules/fibers/future.js:278
throw(ex);
^
[Thu Jun 25 2015 06:35:23 GMT+0000 (UTC)] 
WARNING MongoError: ns name too long, max size is 128
at Object.Future.wait
(/meteor/dev_bundles/0.4.18/lib/node_modules/fibers/future.js:398:15)
at [object Object].MongoConnection._ensureIndex
(packages/mongo/mongo_driver.js:733:1)
at FileCollection.Mongo.Collection._ensureIndex
(packages/mongo/collection.js:620:1)
at new FileCollection (packages/vsivsi:file-
collection/gridFS_server.coffee:65:15)
at FileCollection (packages/vsivsi:file-        
collection/gridFS_server.coffee:21:24)
at app/lib/collections.js:15:12
at /meteor/containers/55bd5013-6244-5f59-9f74-
c6798eb58003/bundle/programs/server/boot.js:229:5
- - - - -

我的collections.js文件中的代码列在下面,注释中注明了第15行。它基于Meteor文件集Sample App第10行。请注意,MD5实际上是一个很长的标识符,但我不确定它是如何/是否被Mongo使用。无论如何,它适用于localhost。

Meteor.startup(function () {
  console.log('collections are loading');
  myData = FileCollection('myFiles', {   // This is line 15 that triggers error
    resumable: true,                        
    http: [                                 
      {                                     
        method: 'get',
          // This GET routes path like /gridfs/myFiles/md5/9f4cd4e1d9e7cb1273ad2860fa909398.jpeg                 
        path: '/md5/:md5',                  
          // note that my :md5 also contains suffix with media type. Suffix was appended in link helper
          // I added suffix so that other programs can determine MIME type from URL's suffix, without reading file header
        lookup: function (params, query) {  
          // params.md5 contains more than the MD5 and hence needs to be split to get true MD5 portion
          var tempArray = params.md5.split('.');
          var firstHalf = tempArray[0];     // heres the MD5 part to ensure that Vaughn's code isn't affected
          return {
            md5: firstHalf                 // a query mapping url to myFiles
          };
        }
      }
    ]
  });
});

2 个答案:

答案 0 :(得分:1)

你可以告诉我app / lib / collections.js:15?

您是否拥有定义了很长名称的集合?

答案 1 :(得分:1)

您的问题与此处的已解决问题相关:https://github.com/vsivsi/meteor-file-collection/issues/55

您的本地数据库名称可能比在meteor.com环境中分配给您的名称短得多。

尝试添加类似

的内容
   resumableIndexName: 'fci', 
行后

   resumable: true,