File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
source/includes/usage-examples/code-snippets Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 6
6
import org .bson .BsonInt64 ;
7
7
import org .bson .Document ;
8
8
9
- import com .mongodb .ConnectionString ;
10
- import com .mongodb .MongoClientSettings ;
11
9
import com .mongodb .MongoException ;
12
10
import com .mongodb .client .MongoClient ;
13
11
import com .mongodb .client .MongoClients ;
14
12
import com .mongodb .client .MongoDatabase ;
13
+ import org .bson .conversions .Bson ;
15
14
16
15
17
16
public class RunCommand {
@@ -28,14 +27,14 @@ public static void main(String[] args) {
28
27
29
28
// Retrieves statistics about the specified database
30
29
Document commandResult = database .runCommand (command );
31
-
30
+
32
31
// Prints the database statistics
33
32
System .out .println ("dbStats: " + commandResult .toJson ());
34
-
35
- // Prints a message if any exceptions occur during the command execution
33
+
36
34
} catch (MongoException me ) {
35
+ // Prints a message if any exceptions occur during the command execution
37
36
System .err .println ("An error occurred: " + me );
38
37
}
39
38
}
40
39
}
41
- }
40
+ }
You can’t perform that action at this time.
0 commit comments