kabilan
kabilan

Reputation: 41

how to get all documents from couchbase lite dot net

I am new to couchbase and couchbase lite. I am trying to implement sync from couchbase lite to couchbase. I did create few documents in couchbase lite using dot net. But i am not able to get all documents to show in the UI.

It would be a great help if i get any code snippet to get all documents from couchbase lite using dot net.

Sample code i am trying to get the documents.

using (var query = QueryBuilder.Select(SelectResult.All())
            .From(DataSource.Database(pat_database)))
            {
                // Run the query
                foreach (var result in query.Execute())
                {
                    Console.WriteLine(result.GetString("id"));
                }
            }
        }

Console.Writeline is not showing the id of the document. Kindly help.

Upvotes: 4

Views: 661

Answers (1)

G. Blake Meike
G. Blake Meike

Reputation: 6715

This answer, from @borrrden, is correct:

When you do SelectResult.All() the results will be inside of a dictionary, not at the top level. So you need to do GetDictionary(0) first. If you select the id directly, you can get it as you have already done.

Upvotes: 0

Related Questions