Skip to content

Commit

Permalink
liquibase#90 Use ListCollectionNamesStatment in DropAllCollectionsSta…
Browse files Browse the repository at this point in the history
…tement and tidy hrefs in javadoc
  • Loading branch information
jsonking committed Feb 20, 2021
1 parent d9b2c7f commit ea48d3c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* Creates a collection via the database runCommand method
* For a list of supported options see the reference page:
* https://docs.mongodb.com/manual/reference/command/create/#create
* @see <a href="https://docs.mongodb.com/manual/reference/command/create/#create">create</a>
*/
@Getter
@EqualsAndHashCode(callSuper = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@
* #L%
*/

import com.mongodb.client.MongoCollection;
import liquibase.ext.mongodb.database.MongoLiquibaseDatabase;
import liquibase.nosql.statement.NoSqlExecuteStatement;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.bson.Document;

import java.util.function.Consumer;

Expand All @@ -44,7 +42,7 @@ public String getCommandName() {

@Override
public void execute(final MongoLiquibaseDatabase database) {
getMongoDatabase(database).listCollectionNames()
new ListCollectionNamesStatement().queryForList(database).stream()
.map(DropCollectionStatement::new)
.forEach((Consumer<? super DropCollectionStatement>) s -> s.execute(database));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

/**
* Drops a collection
* See https://docs.mongodb.com/manual/reference/command/drop/ for supported options
* See @see <a href="https://docs.mongodb.com/manual/reference/command/drop/">drop</a> for supported options
*/
@Getter
@EqualsAndHashCode(callSuper = true)
Expand Down Expand Up @@ -58,9 +58,4 @@ public String getCollectionName() {
return command.getString(RUN_COMMAND_NAME);
}

@Override
public String toJs() {
return String.format("db.%s.drop();", getCollectionName());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
/**
* Inserts many documents via the database runCommand method
* For a list of supported options see the reference page:
* https://docs.mongodb.com/manual/reference/command/insert/
* @see <a href="https://docs.mongodb.com/manual/reference/command/insert/">insert</a>
*/
@Getter
@EqualsAndHashCode(callSuper = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
/**
* Inserts a document via the database runCommand method
* For a list of supported options see the reference page:
* @see <a href="https://docs.mongodb.com/manual/reference/command/insert/">Insert</a>
* @see <a href="https://docs.mongodb.com/manual/reference/command/insert/">insert</a>
*/
@Getter
@EqualsAndHashCode(callSuper = true)
Expand Down

0 comments on commit ea48d3c

Please sign in to comment.