mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
mongo sort
This commit is contained in:
parent
0db9ae7cb1
commit
007b40bf9b
@ -1,5 +1,5 @@
|
||||
<script context="module" lang="ts">
|
||||
export function buildGridMongoCondition(props) {
|
||||
function buildGridMongoCondition(props) {
|
||||
const filters = props?.display?.config?.filters;
|
||||
|
||||
const conditions = [];
|
||||
@ -27,6 +27,19 @@
|
||||
: undefined;
|
||||
}
|
||||
|
||||
function buildMongoSort(props) {
|
||||
const sort = props?.display?.config?.sort;
|
||||
|
||||
if (sort?.length > 0) {
|
||||
return _.zipObject(
|
||||
sort.map(col => col.uniqueName),
|
||||
sort.map(col => (col.order == 'DESC' ? -1 : 1))
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
export async function loadCollectionDataPage(props, offset, limit) {
|
||||
const { conid, database } = props;
|
||||
|
||||
@ -43,6 +56,7 @@
|
||||
limit,
|
||||
skip: offset,
|
||||
condition: buildGridMongoCondition(props),
|
||||
sort: buildMongoSort(props),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user