Tag: 数据

如何对Google Datastore中的很多实体进行总计?

我想了解Google数据存储是否可以满足我的需求。 我有很多的实体,我需要对某个财产进行总计。 基本上,我希望能够select count(value1) from entity1 where [some filter] ,entity1是一个实体,用于跟踪其字段/属性value1某种数据。 我知道这些types的函数在数据存储中不可用,因为它不是关系数据库,所以最直接的解决scheme是执行一个select ,然后计算应用程序中结果集的总和。 所以我会喜欢(使用nodejs,但我不在乎语言): query = client.query(kind='Task') query.add_filter('done', '=', False) results = list(query.fetch()) total = 0 for(v in results) total += v.value 问题是我有成千上万的logging,所以结果可能就是300000条logging。 什么是最好的方式来做到这一点,而不是一个瓶颈?

上传文件时抓取API和multer错误

我试图使用获取API上传文件到一个node.js服务器(我使用github的pollyfill,如果它与它有关: https : //github.com/github/fetch )。 请求是这样完成的: const data = new FormData(); data.append('file', file); return fetch(this.concatToUrl(url), { method: 'post', headers: Object.assign({}, this.getHeaders(), {'Content-Type': 'multipart/form-data'}), body: data, }); 在服务器端,我有这个路由的声明: app.post('/media', upload.single('file'), mediaRoutes.postMedia); 并试图获得这样的文件: exports.postMedia = function(req, res) { console.log('req.file', req.file, req.files, req.body); return res.sendStatus(200); } 但req.file没有被填充。 另外,我从expression方面得到这个错误: Error: Multipart: Boundary not found [2] at new Multipart (/Users/jmanzano/Development/web/test/node_modules/busboy/lib/types/multipart.js:58:11) […]