mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 01:56:12 +01:00
feat: test psql without defineProperty (#7815)
* feat: test psql without defineProperty * feat: refactor psql remove .bind calls, use module.pool.query directly move requires to top of file move promisify to bottom so .init etc are promisified * feat: mongodb move requires to bottom * feat: redis
This commit is contained in:
committed by
GitHub
parent
52a2e5d61d
commit
af1f7249a7
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (db, module) {
|
||||
module.exports = function (module) {
|
||||
module.sortedSetIntersectCard = async function (keys) {
|
||||
if (!Array.isArray(keys) || !keys.length) {
|
||||
return 0;
|
||||
@@ -13,7 +13,7 @@ module.exports = function (db, module) {
|
||||
{ $group: { _id: null, count: { $sum: 1 } } },
|
||||
];
|
||||
|
||||
const data = await db.collection('objects').aggregate(pipeline).toArray();
|
||||
const data = await module.client.collection('objects').aggregate(pipeline).toArray();
|
||||
return Array.isArray(data) && data.length ? data[0].count : 0;
|
||||
};
|
||||
|
||||
@@ -87,7 +87,7 @@ module.exports = function (db, module) {
|
||||
}
|
||||
pipeline.push({ $project: project });
|
||||
|
||||
let data = await db.collection('objects').aggregate(pipeline).toArray();
|
||||
let data = await module.client.collection('objects').aggregate(pipeline).toArray();
|
||||
|
||||
if (!params.withScores) {
|
||||
data = data.map(item => item.value);
|
||||
|
||||
Reference in New Issue
Block a user