💾MongoDb loader

Database loader loads data into a list from MongoDB.

Database loader must extend AbstractMongoDbLoader.

AbstractMongoDbLoader methods:

String getCollectionName() //Gets collection name which loader will load data
String getCollectionNameWithPrefix() //Gets collection name with minigame tables' prefix
MongoDatabase getMongoDatabase() //Gets mongo database
void loadDocument(Document document) //Loads single document
void load(String collectionName) //loads whole collection

How to create a database loader?

The prefix of the table will be added automatically.

public class MongoDbMyUser Loader extends AbstractMongoDbLoader<MyUser> {
    
    @Override
    protected String getCollectionName() {
        return MyUser.COLLECTION_NAME;
    }

    @Override
    protected void loadDocument(Document document) {
       //define your logic of loading single document
    }
}

Last updated