0

I want to use couch db lite for an application which I am developing targeting windows using .NET I have installed couch lite version 1.1.0.1 using nuget. I am facing multiple issues , 1. After I save a document when I tried to read it I am getting an error majorly when I tried to read the document. here is the exception

Database: Error getting doc numeric id
System.Threading.ThreadAbortException: Thread was being aborted.
   at System.Threading.Thread.YieldInternal()
   at System.Threading.Tasks.Task.SpinWait(Int32 millisecondsTimeout)
   at System.Threading.Tasks.Task.SpinThenBlockingWait(Int32 millisecondsTim
 eout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.InternalWait(Int32 millisecondsTimeout, Ca
   ncellationToken cancellationToken)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNoti
  fication)
   at System.Threading.Tasks.Task`1.get_Result()
   at Couchbase.Lite.SqlitePCLRawStorageEngine.RawQuery(String sql, Object[]
   paramArgs)
   at Couchbase.Lite.SqlitePCLRawStorageEngine.IntransactionRawQuery(String
    sql, Object[] paramArgs)
   at Couchbase.Lite.Database.GetDocNumericID(String docId)

My code is

     public class CouchliteBaseRepository
    {
      Manager _manager;
      Database _db;

       public CouchliteBaseRepository()
      {
        _manager = new Manager(new System.IO.DirectoryInfo(@"D:\         
        Client\Test.ClientStartup\bin\Debug"), Manager.DefaultOptions);

        _db = _manager.GetDatabase("couchorderdb");

      }
      public void UpdateData(string key, Dictionary<string, object> dt)
      {
        _db = _manager.GetDatabase("couchorderdb");


            var document = _db.GetExistingDocument(key);


            if (document == null)
                document = _db.GetDocument(key);
            else
                dt.Add("_rev", document.CurrentRevisionId);

            var rev = document.PutProperties(dt);

            //_manager.Close();



      }


      public void GetData(string key)
      {

       // _db = _manager.GetDatabase("couchorderdb");

        var document = _db.GetExistingDocument(key);
        var revid = document.CurrentRevisionId;
       // doc.Purge();
        var data = document.UserProperties;
        _manager.Close();
       Console.Write("tt");
      }  

    }

I am calling the the UpdateDatato set data in document and then calling the GetData passing the key , Am I Missing anything here?. The key I used is as below

   couchlite.UpdateData(string.Format("{0:yyyy-MMddHH}", DateTime.Now),    
    bulkdata);
borrrden
  • 33,256
  • 8
  • 74
  • 109
jereesh thomas
  • 113
  • 1
  • 13
  • Nothing seems to be particularly wrong unless some of the commented things were uncommented. Can you share the portion where you create and use this class? – borrrden Jul 21 '15 at 04:49
  • This seems to be happening when there are lot of numbers of items inside bulkdata dictionary , Is there a limit on the number of items which are being saved and read(the issue happen mostly during read) – jereesh thomas Jul 22 '15 at 13:49
  • No, there is not. The reason I asked what I did is because it looks like this code was running on a separate thread that got aborted. – borrrden Jul 22 '15 at 22:31

0 Answers0