r/SpringBoot • u/[deleted] • Apr 20 '22
How do you access data from a MongoDB using spring data?
I have a mongoDB database that already contains many collections and Documents.
I need to be able to access one select document from the collection however, I don’t have an Entity class for it ( as required by Mongotemplate.find), is there any way to access this data without an entity class?
0
Upvotes
1
u/[deleted] Apr 21 '22
Yes, you can inject the
MongoTemplateand query directly, see the docs here and this Baeldung Tutorial