I'm currently using MongoTemplate to POST the contents of a class using the mongoTemplate.save method.
However, I noticed that this ONLY posts to a database / document with the same name that was set in the MongoTemplate constructor.
That is, if I have -
val mongoTemplate = MongoTemplate(MongoClient(/*...uri...*/), "DatabaseA")
What happens is that I then have a Database/Document titled "DatabaseA.DatabaseA"
However, I wish to post to a different document WITHIN DatabaseA, that is DatabaseA.DocumentB and so on.
I looked online but found no reference how to do that. is it possible to do so with MongoTemplate?
Whelp, looking over it seems you can't. It seems the above pattern is by design with no way to override it.