Skip to content

Instantly share code, notes, and snippets.

@mtrakal
Last active March 20, 2017 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtrakal/a05ca0021bed224bad64f98baced412b to your computer and use it in GitHub Desktop.
Save mtrakal/a05ca0021bed224bad64f98baced412b to your computer and use it in GitHub Desktop.
public List<Record> getRecordsWithTransferId(final String transferId) {
com.couchbase.lite.Query query = CouchBaseModule.getDatabase().createAllDocumentsQuery();
query.setAllDocsMode(com.couchbase.lite.Query.AllDocsMode.ALL_DOCS);
query.setPostFilter(new Predicate<QueryRow>() {
@Override
public boolean apply(QueryRow type) {
if (!type.getDocumentId().startsWith("Record_")) {
return false;
}
Map<String, Object> map = type.getDocument().getUserProperties();
return map.containsKey(TRANSFER_ID) && map.get(TRANSFER_ID).equals(transferId);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment