org.mongodb.MongoDatabase Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mongoFS Show documentation
Show all versions of mongoFS Show documentation
An extension to the MongoDB Java Driver library that goes beyond what the GridFS feature supports.
Compressed file storage, zip files, temporary files
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