c# - Get all Document IDs in Couchbase -
i'm new couchbase lite 4.6.2 , trying ids of every document in database. i'm interfacing using c# .net in visual studio 2017 community. plan paginate later if need be, , realize may inefficient, can't figure out way ids inefficiently. here i've got far:
internal void loadentries() { lstkeys.items.clear(); var config = new clientconfiguration { servers = new list<uri> { new uri("http://localhost:8091/pools"), }, usessl = false, defaultoperationlifespan = 1000, bucketconfigs = new dictionary<string, bucketconfiguration> { { properties.settings.default.db_name, new bucketconfiguration { bucketname = "default", usessl = false, //password = "", defaultoperationlifespan = 2000//, //poolconfiguration = new poolconfiguration //{ //maxsize = 10, //minsize = 5, //sendtimeout = 12000 //} } } } }; using (var cluster = new cluster(config)) { using (var bucket = cluster.openbucket(properties.settings.default.db_name)) { list<string> all_ids = new list<string>(); var query = new viewquery(properties.settings.default.db_name, "http://localhost:8091/pools").from("dev_keys", "keys"); var docs = bucket.query<dynamic>(query); foreach (var doc in docs.rows) { all_ids.add(doc.key); } foreach (string id in all_ids) { var = bucket.getdocument<dynamic>(id); var document = get.document; button btn = new button(); btn.horizontalalignment = horizontalalignment.stretch; btn.minheight = 26; btn.content = document.content.name; lstkeys.items.add(btn); } } } }
any ideas/direction grandly appreciated.
Comments
Post a Comment