I have just about reached my wits end w.r.t using couchbase for a simple store/query operation. I have failed to find any documentation which can give me insight into my issue. To begin (using example code from the documentation) I attempt to store a document inside my database
MutableDocument mutableDoc = new MutableDocument()
.setFloat("version", 2.0F)
.setString("type", "SDK");
// Save it to the database.
try{
database.save(mutableDoc);
}
catch (CouchbaseLiteException e){
}
Once done, I attempt to retrieve said documents from the database using the following:
// Create a query to fetch documents of type SDK.
Query query = QueryBuilder.select(SelectResult.all())
.from(DataSource.database(database))
.where(Expression.property("type").equalTo(Expression.string("SDK")));
try{
ResultSet results = query.execute();
for (Result result : results) {
Log.i("SCRABBLER","In loop!");
Log.i("SCRABBLER", "Type: " + (result.getValue("type"));
}
}
catch (CouchbaseLiteException e){
Log.e("SCRABBLER", e.getLocalizedMessage());
}
Keep in mind, attempting to get the count correctly returns the number of documents and if I use the cblite tool I can see my documents in the database. What in god’s name am I missing here? It seems this should be a simple operation.
Calling getKeys() on the result returns one key with the name of the actual DB. Am I not using this SDK properly?