Skip to content

DOCSP-34069: fix imports for run command usage example #482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions source/includes/usage-examples/code-snippets/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
import org.bson.BsonInt64;
import org.bson.Document;

import com.mongodb.ConnectionString;
import com.mongodb.MongoClientSettings;
import com.mongodb.MongoException;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoDatabase;
import org.bson.conversions.Bson;


public class RunCommand {
Expand All @@ -28,14 +27,14 @@ public static void main(String[] args) {

// Retrieves statistics about the specified database
Document commandResult = database.runCommand(command);

// Prints the database statistics
System.out.println("dbStats: " + commandResult.toJson());

// Prints a message if any exceptions occur during the command execution

} catch (MongoException me) {
// Prints a message if any exceptions occur during the command execution
System.err.println("An error occurred: " + me);
}
}
}
}
}