Skip to content

Commit fa04069

Browse files
authored
Merge pull request #102 from djsauble/patch-16
Update FindDatabase.java
2 parents 620d4c0 + dad0d23 commit fa04069

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

astra-db-client/src/test/java/com/dtsx/astra/sdk/documentation/FindDatabase.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,23 @@
22

33
import com.dtsx.astra.sdk.AstraDBAdmin;
44
import com.dtsx.astra.sdk.db.domain.Database;
5-
65
import java.util.Optional;
76
import java.util.UUID;
87
import java.util.stream.Stream;
98

109
public class FindDatabase {
11-
public static void main(String[] args) {
12-
13-
AstraDBAdmin client = new AstraDBAdmin("<replace_with_token>");
10+
public static void main(String[] args) {
11+
AstraDBAdmin client = new AstraDBAdmin("<token>");
1412

15-
// Check is a database exists
16-
boolean exists = client.isDatabaseExists("<replace_with_db_name>");
13+
// Check if a database exists
14+
boolean exists = client.isDatabaseExists("<database_name>");
1715

18-
// Find a database from its name (name does not ensure unicity)
19-
Stream<Database> dbStream = client.findDatabaseByName("<replace_with_db_name>");
20-
Optional<Database> dbByName = dbStream
21-
.findFirst();
16+
// Find a database by name (names may not be unique)
17+
Stream<Database> dbStream = client.findDatabaseByName("<database_name>");
18+
Optional<Database> dbByName = dbStream.findFirst();
2219

23-
// Find a database from its id
24-
Optional<Database> dbById = client
25-
.findDatabaseById(UUID.fromString("<replace_with_db_uuid>"));
26-
}
20+
// Find a database by ID
21+
Optional<Database> dbById = client
22+
.findDatabaseById(UUID.fromString("<replace_with_db_uuid>"));
23+
}
2724
}

0 commit comments

Comments
 (0)