
uk.co.mruoc.promo.repository.account.mongo.AccountCollection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of burger-promo Show documentation
Show all versions of burger-promo Show documentation
Burger promotion backend apis
The newest version!
package uk.co.mruoc.promo.repository.account.mongo;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.model.Indexes;
import org.bson.conversions.Bson;
public class AccountCollection {
public static final String CLAIMED_PROMOS_INDEX_NAME = "claimedPromos";
private static final String NAME = "account";
private AccountCollection() {
// constants class
}
public static void create(MongoDatabase database) {
database.createCollection(NAME);
database.getCollection(NAME).createIndex(indexKeys());
}
public static MongoCollection get(MongoDatabase database) {
return database.getCollection(NAME, AccountDocument.class);
}
private static Bson indexKeys() {
return Indexes.ascending(CLAIMED_PROMOS_INDEX_NAME);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy