File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
js/server/modules/@arangodb Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -77,9 +77,20 @@ var ArangoDatabase = require('@arangodb/arango-database').ArangoDatabase;
77
77
ArangoCollection . prototype . shards = function ( detailed ) {
78
78
let base = ArangoClusterInfo . getCollectionInfo ( require ( 'internal' ) . db . _name ( ) , this . name ( ) ) ;
79
79
if ( detailed ) {
80
+ // Will return an object.
80
81
return base . shards ;
81
82
}
82
- return Object . keys ( base . shardShorts ) ;
83
+
84
+ // (!detailed) will return only the shard ids in sorted order
85
+ return Object . keys ( base . shardShorts ) . sort ( function ( a , b ) {
86
+ if ( parseInt ( a . substring ( 1 , a . length ) ) > parseInt ( b . substring ( 1 , b . length ) ) ) {
87
+ return 1 ;
88
+ }
89
+ if ( parseInt ( a . substring ( 1 , a . length ) ) < parseInt ( b . substring ( 1 , b . length ) ) ) {
90
+ return - 1 ;
91
+ }
92
+ return 0 ;
93
+ } ) ;
83
94
} ;
84
95
85
96
// //////////////////////////////////////////////////////////////////////////////
You can’t perform that action at this time.
0 commit comments