File tree Expand file tree Collapse file tree 3 files changed +49
-5
lines changed Expand file tree Collapse file tree 3 files changed +49
-5
lines changed Original file line number Diff line number Diff line change @@ -1146,6 +1146,16 @@ const translations: Catalog = {
1146
1146
description : 'Calls the isMaster command' ,
1147
1147
example : 'db.isMaster()'
1148
1148
} ,
1149
+ hello : {
1150
+ link : 'https://docs.mongodb.com/manual/reference/method/db.hello' ,
1151
+ description : 'Calls the hello command' ,
1152
+ example : 'db.hello()'
1153
+ } ,
1154
+ rotateCertificates : {
1155
+ link : 'https://docs.mongodb.com/manual/reference/method/db.rotateCertificates' ,
1156
+ description : 'Calls the rotateCertificates command' ,
1157
+ example : 'db.rotateCertificates()'
1158
+ } ,
1149
1159
serverBuildInfo : {
1150
1160
link : 'https://docs.mongodb.com/manual/reference/method/db.serverBuildInfo' ,
1151
1161
description : 'returns the db serverBuildInfo. uses the buildInfo command' ,
Original file line number Diff line number Diff line change @@ -819,6 +819,17 @@ export default class Database extends ShellApiClass {
819
819
) ;
820
820
}
821
821
822
+ @returnsPromise
823
+ @serverVersions ( [ '5.0.0' , ServerVersions . latest ] )
824
+ async hello ( ) : Promise < Document > {
825
+ this . _emitDatabaseApiCall ( 'hello' , { } ) ;
826
+ return await this . _runCommand (
827
+ {
828
+ hello : 1 ,
829
+ }
830
+ ) ;
831
+ }
832
+
822
833
@returnsPromise
823
834
async serverBuildInfo ( ) : Promise < Document > {
824
835
this . _emitDatabaseApiCall ( 'serverBuildInfo' , { } ) ;
@@ -870,6 +881,17 @@ export default class Database extends ShellApiClass {
870
881
) ;
871
882
}
872
883
884
+ @returnsPromise
885
+ @serverVersions ( [ '5.0.0' , ServerVersions . latest ] )
886
+ async rotateCertificates ( message ?: string ) : Promise < Document > {
887
+ this . _emitDatabaseApiCall ( 'rotateCertificates' , { message } ) ;
888
+ return await this . _runAdminCommand (
889
+ {
890
+ serverStatus : 1 , message
891
+ }
892
+ ) ;
893
+ }
894
+
873
895
@returnsPromise
874
896
async printCollectionStats ( scale = 1 ) : Promise < Document > {
875
897
if ( typeof scale !== 'number' || scale < 1 ) {
Original file line number Diff line number Diff line change @@ -1922,11 +1922,23 @@ describe('Shell API (integration)', function() {
1922
1922
} ) ;
1923
1923
} ) ;
1924
1924
} ) ;
1925
- describe ( 'Field-level encryption' , ( ) => {
1926
- // This test is temporary and can go away once we actually implement FLE
1927
- // functionality.
1928
- it ( 'native addon is present' , ( ) => {
1929
- expect ( typeof serviceProvider . fle . ClientEncryption ) . to . equal ( 'function' ) ;
1925
+
1926
+ describe ( 'database commands' , ( ) => {
1927
+ it ( 'db.isMaster() works' , async ( ) => {
1928
+ expect ( ( await database . isMaster ( ) ) . ismaster ) . to . equal ( true ) ;
1929
+ } ) ;
1930
+
1931
+ context ( 'with 5.0+ server' , ( ) => {
1932
+ skipIfServerVersion ( testServer , '<= 4.4' ) ;
1933
+
1934
+ it ( 'db.hello() works' , async ( ) => {
1935
+ expect ( ( await database . hello ( ) ) . isWritablePrimary ) . to . equal ( true ) ;
1936
+ } ) ;
1937
+
1938
+ it ( 'db.rotateCertificates() works' , async ( ) => {
1939
+ expect ( ( await database . rotateCertificates ( ) ) . ok ) . to . equal ( 1 ) ;
1940
+ expect ( ( await database . rotateCertificates ( 'message' ) ) . ok ) . to . equal ( 1 ) ;
1941
+ } ) ;
1930
1942
} ) ;
1931
1943
} ) ;
1932
1944
You can’t perform that action at this time.
0 commit comments