All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mongodb.MongoDatabase Maven / Gradle / Ivy

Go to download

An extension to the MongoDB Java Driver library that goes beyond what the GridFS feature supports. Compressed file storage, zip files, temporary files

There is a newer version: 0.10.0
Show newest version
package org.mongodb;

import com.mongodb.DB;
import com.mongodb.DBCollection;

public class MongoDatabase {

    private DB surrogate;

    public MongoDatabase(final DB surrogate) {
        this.setSurrogate(surrogate);

    }

    public CommandResult executeCommand(final Document cmd) {

        CommandResult result = new CommandResult(getSurrogate().command(cmd.getSurrogate()));
        return result;
    }

    public Object getName() {
        return getSurrogate().getName();
    }

    public MongoCollection getCollection(final String name, final MongoCollectionOptions options) {
        DBCollection collection = getSurrogate().getCollection(name);
        collection.setReadPreference(options.getReadPreference());
        collection.setWriteConcern(options.getWriteConcern());
        return new MongoCollection(collection);
    }

    public DB getSurrogate() {
        return surrogate;
    }

    public void setSurrogate(final DB surrogate) {
        this.surrogate = surrogate;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy