@Autowired
private MongoTemplate mt;
public String ping()
{
DBObject ping = new BasicDBObject("ping", "1");
try {
CommandResult answer = mt.getDb().command(ping);
return answer.getErrorMessage();
} catch (Exception e) {
return e.getMessage();
}
Thursday, 28 November 2019
Check MongoDB connection using MongoTemplate in Spring Boot
Subscribe to:
Posts (Atom)
Code Review
SOLID Principles S – Single Responsibility Principle There should never be more than one reason for a class to change. O – Open-Closed Prin...
-
@Autowired private MongoTemplate mt ; public String ping () { DBObject ping = new BasicDBObject ( "ping" , ...
-
1. Print the word with odd letters as P M R A O R G O R R A P M #include<stdio.h> #i...