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
聚合计数查询在Meteor 1.8中不再有效_Meteor - Fatal编程技术网

聚合计数查询在Meteor 1.8中不再有效

聚合计数查询在Meteor 1.8中不再有效,meteor,Meteor,我一直在查询中使用聚合来获取总记录数,但今天我从Meteor 1.2迁移到了1.8,现在下面的查询给了我一个例外: 我正在服务器端使用meteorhacks:aggregate@1.3.0版 查询: Articles.aggregate([ { $match: {userId: 'a767GGhrd743Ghe349sd'} }, { $group: { _id: null, count: { $sum: 1 } } } ])[0]; Ty

我一直在查询中使用聚合来获取总记录数,但今天我从Meteor 1.2迁移到了1.8,现在下面的查询给了我一个例外:

我正在服务器端使用meteorhacks:aggregate@1.3.0版

查询:

Articles.aggregate([
      { $match: {userId: 'a767GGhrd743Ghe349sd'} },
      { $group: { _id: null, count: { $sum: 1 } } }               
])[0];
TypeError: Cannot read property \'count\' of undefined\n
例外情况:

Articles.aggregate([
      { $match: {userId: 'a767GGhrd743Ghe349sd'} },
      { $group: { _id: null, count: { $sum: 1 } } }               
])[0];
TypeError: Cannot read property \'count\' of undefined\n
在Meteor 1.2中,相同的查询给了我计数器,但由于我已更新到Meteor 1.8,现在它不再工作。

您使用的软件包(
meteorhacks:aggregate
)大约从2015年起被放弃。对于新的Mongo>=3.0.0(从Meteor 1.7开始引入),此软件包将不再工作,因为Mongo驱动程序中存在突破性的更改

另一种方法是针对或使用包的活动维护分支自行实现聚合功能,如

分叉包本身:

流星骇客/流星聚集似乎很难维护,所以让我们维护一个分叉!Meteor 1.7及其对mongodriver v3的升级引入了一些突破性的变化,这将打破meteorhacks:Meteor aggregate

您正在使用的软件包(
meteohacks:aggregate
)大约从2015年起被放弃。对于新的Mongo>=3.0.0(从Meteor 1.7开始引入),此软件包将不再工作,因为Mongo驱动程序中存在突破性的更改

另一种方法是针对或使用包的活动维护分支自行实现聚合功能,如

分叉包本身:

流星骇客/流星聚集似乎很难维护,所以让我们维护一个分叉!Meteor 1.7及其对mongodriver v3的升级引入了一些突破性的变化,这将打破meteorhacks:Meteor aggregate


您是使用atmosphere包还是mongo驱动程序默认内置Meteor应用聚合?这是在服务器上还是在minimongo客户端上?使用atmosphere软件包,在服务器端请添加软件包名称和软件包版本,以确保软件包兼容性和Meteor 1.8没有问题。我已使用软件包和版本更新了我的问题。下面的答案是否解决了您的问题?您是使用atmosphere软件包还是使用mongo驱动程序默认内置应用聚合在《流星》中?这是在服务器上还是在minimongo客户端上?使用atmosphere软件包及其服务器端请添加软件包名称和软件包版本,以确保软件包兼容性和Meteor 1.8没有问题。我已使用软件包和版本更新了我的问题。我下面的回答是否解决了您的问题?