Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.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
Collections 流星收集未定义_Collections_Meteor - Fatal编程技术网

Collections 流星收集未定义

Collections 流星收集未定义,collections,meteor,Collections,Meteor,各位。 在服务器文件夹中使用集合变量时,它会出错。“ReferenceError:未定义测试” 以下是文件结构: 收藏 --Test.coffee#@Test=新流星收藏“Test” 服务器 --模拟数据 --test_server.coffee#console.log test.find().count() 但如果我直接在服务器fodler中使用集合“test”,它就可以工作了。 如: 服务器 --test_server.coffee#console.log test.find().count

各位。 在服务器文件夹中使用集合变量时,它会出错。“ReferenceError:未定义测试”

以下是文件结构: 收藏 --Test.coffee#@Test=新流星收藏“Test” 服务器 --模拟数据 --test_server.coffee#console.log test.find().count()

但如果我直接在服务器fodler中使用集合“test”,它就可以工作了。 如: 服务器 --test_server.coffee#console.log test.find().count()

我认为Meteor的文件加载规则应该对这个问题负责。但我还是
不知道为什么会出现问题。

我想你的问题是文件夹越深,读取时间越早。所以test_server.coffee将在test.coffee之前读取,因为它嵌套得更深

以下是有关如何构建应用程序的更多信息:


我认为您的问题是文件夹越“深”,读取时间越早。所以test_server.coffee将在test.coffee之前读取,因为它嵌套得更深

以下是有关如何构建应用程序的更多信息:


我将collections.js移到了/lib,它解决了我的问题。也许它也能帮你摆脱困境


/lib文件夹中的文件在其他文件之前执行。因此,确保在加载和运行任何服务器脚本之前定义了集合“测试”。

我将我的collections.js移动到了/lib,它解决了我的问题。也许它也能帮你摆脱困境


/lib文件夹中的文件在其他文件之前执行。因此,请确保在加载和运行任何服务器脚本之前定义了集合“Test”。

thx,我还认为我的问题与文件结构有关。文件结构对加载顺序很重要。Thx再次。Thx,我也认为我的问题是关于我的文件结构。文件结构对加载顺序也很重要。