mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 09:05:59 +00:00
perspectives: support nosql other than mongo
This commit is contained in:
@@ -305,7 +305,12 @@ const driver = {
|
||||
} else if (options.aggregate) {
|
||||
let cursor = await collection.aggregate(convertObjectId(convertToMongoAggregate(options.aggregate)));
|
||||
const rows = await cursor.toArray();
|
||||
return { rows: rows.map(transformMongoData) };
|
||||
return {
|
||||
rows: rows.map(transformMongoData).map((x) => ({
|
||||
...x._id,
|
||||
..._.omit(x, ['_id']),
|
||||
})),
|
||||
};
|
||||
} else {
|
||||
// console.log('options.condition', JSON.stringify(options.condition, undefined, 2));
|
||||
let cursor = await collection.find(convertObjectId(mongoCondition) || {});
|
||||
@@ -313,7 +318,9 @@ const driver = {
|
||||
if (options.skip) cursor = cursor.skip(options.skip);
|
||||
if (options.limit) cursor = cursor.limit(options.limit);
|
||||
const rows = await cursor.toArray();
|
||||
return { rows: rows.map(transformMongoData) };
|
||||
return {
|
||||
rows: rows.map(transformMongoData),
|
||||
};
|
||||
}
|
||||
} catch (err) {
|
||||
return { errorMessage: err.message };
|
||||
|
||||
Reference in New Issue
Block a user