I need to write an application with which I can do complex queries using spring-data and mongodb. I have been starting by using the MongoRepository but struggled with complex queries to find examples or to actually understand the Syntax.
I'm …
I have the following exception when running Java app for MongoDB:
[localhost:27017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server localhost:27017 while accessing MongoDB with Java
Call stack is follows:
com.mongodb.MongoSocketOpenException: Exception opening socket
…
How can we select specific fields in Spring Data Mongo. I tried the following but I got cast exception from Foo to String.
Using @Query
@Query(value="{path : ?0}", fields="{path : 0}")
String findPathByPath(String path);
Non @Query
String findPathByPath(String path);
…