0

I am using Spring boot with Mongodb and developing my new application. I can use MongoRepository for database operations as well as Mongotemplate. I am using mongotemplate for my complex queries and MongoRepository small queries related to any field of POJO.

Is it ok to use both mongoRepository and MongoTemplate both in application ?

1 Answers1

1

Yes, you can use both.

Though note that Spring Data MongoDB (just like the other provider-specific flavors) has a repository extension mechanism to handle complex querying. Not to mention @Query. But if you want MongoTemplate you can do that too.