Hi all,
Quick question... I've tried different ways of doing it but I can't seem to be able to do it without reverting to the standard Java driver for Mongo.
I'm building (or trying to...) a multi-tenanted application that sandboxes each customer (tenant) by their own Mongo database, as it seems considerably better and far less unwieldy than using prefixed collection names in one great big database. Is there a way in the mongo-jackson-mapper to alter the source database name as the base reference prior to invoking a getCollection()? I can't seem to find reference to a setDB(), setDatabase(), setConfig(), etc. anywhere. I think i'm just looking in the wrong place or misinterpreting the documentation.
I'm setting up DAOs using the standard approach recommended in the documentation after configuration in the application.conf file:
something like:
private static JacksonDBCollection<Category, String> coll = MongoDB.getCollection("brand", Category.class, String.class);
with a config of:
mongodb.database="vendor"
mongodb.servers="x.x.x.x:27017"
which i've had no problems with using a single database. However, since there now could be many databases, i need to load the database name dynamically based on login identity, so having an array of datasource configs in a file is not really an option.
Thanks in advance,
Shrike71