So with this method (hard coded for the example)
def findHistoryList(String link_value) {
String sFirst = """
[
{
\$project: {
created_by_name: '\$record_revision.created_by_name',
obsoleted_by_name: '\$record_revision.obsoleted_by_name'
}
}
]
"""
String sSecond = """
{
\$match: {
link_value: 'ec5b022a'
}
}
"""
log.debug(sFirst)
log.debug(sSecond)
def g = inventory.aggregate(sFirst)
.and(sSecond)
//.as(HistoryList.class)
}
If i leave the 'as' operator commented out, this method does return and 'g' is of a type aggregate something. i cant really figure it out. But, if i uncomment 'as' and i put anything in there from my pojo to just Map.class (this method happens to be the only thing in my application that isn't a Map<String, Object> and thats simply because this is the first that requires me to deal with the _id field) i get the following error
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is com.mongodb.MongoCommandException: Command failed with error 40324: 'Unrecognized pipeline stage name: '0'' on server localhost:27017. The full response is { "ok" : 0.0, "errmsg" : "Unrecognized pipeline stage name: '0'", "code" : 40324, "codeName" : "Location40324" }
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
Now, i tried to register jackson with the DB connection with this
@Autowired
InventoryDao(DB rufusdb){
this.rufusdb = rufusdb
Jongo jongo = new Jongo(this.rufusdb,
new JacksonMapper.Builder()
.registerModule(new JodaModule())
.enable(MapperFeature.AUTO_DETECT_GETTERS)
// .withView(Views.Public.class)
.build()
)
inventory = jongo.getCollection("inventory")
}
i don't get any errors on it, but it also has no effect.
compile "org.mongodb:mongo-java-driver:3.4.2"
compile 'org.jongo:jongo:1.3.0'
are my versions