Open bhaskarmurthy opened 11 years ago
this looks like a duplicate of https://github.com/couchbase/couchbase-lite-android/issues/39 and or https://github.com/couchbase/couchbase-lite-android/issues/38
I don't think this is a duplicate of those, re-opening.
Maybe this issue will go away when we upgrade to ektorp 1.4
Assuming 1.4 will fix this, closing as duplicate of https://github.com/couchbase/couchbase-lite-android/issues/38
I had this issue. I think the problem is that when you emit an _id
in CouchDB, it is replaced with a document that has the respective id. CBLite deviates somehow. Here is a workaround (roughly translated from Scala, not tested):
ObjectMapper objectMapper = new ObjectMapper()
for (ViewResult.Row row : results.getRows()) {
doc = objectMapper.readValue(row.getDoc(), clazz)
// add the doc to a list
}
Namely, the difference to CouchDB is that row.getValue()
just returns the _id
, so you have to use row.getDoc()
to fetch the document directly.
I doubt it’s an Ektorp issue.
@stanch thanks for this insight. Re-opening based on your comment.
Do you think this could be tracked in couchbase-lite-android?
One more thing, there is an include_docs
query parameter in the HTTP API. In Ektorp it is represented by new ViewQuery(). ... .includeDocs(true)
.
Do you think this could be tracked in couchbase-lite-android?
@stanch sure - can you open a bug in couchbase-lite-android which points back to this one, and then close this one? (to avoid duplication)
there is an include_docs query parameter ..
Lets consider that a separate issue for now. Can you file a ticket to track it? Be explicit and give an example of the actual api and the expected api.
When running a query using
queryView(ViewQuery)
, I get the right results inViewResult
. However, when usingqueryView(ViewQuery, Class<T>)
, I get 0 results.My TDView looks like:
My repository looks like:
Result from queryView(ViewQuery) looks like: ignoreNotFound = false offset = 0 rows = [org.ektorp.ViewResult$Row@4155a408, org.ektorp.ViewResult$Row@4156a648] totalRows = 2 updateSeq = null
Result from queryView(ViewQuery, Class) looks like:
modCount = 0
Is there a discrepancy in behaviour of these methods? Or could there be an issue in the mapping?