Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-1143

Subdocument Exists always returns true

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.2.8
    • 2.3.3
    • library
    • None

    Description

      Summary: This is major, assuming I'm doing it right. Whenever I use Exists on a subdocument, it always returns true, even if the path doesn't actually exist.

      Example code:

       
       {{           var doc = new Document<dynamic>
                  {
                      Id = "Foo::123",
                      Content = new
                      {
                          Username = "mgroves",
                          Profile = new
                          {
                              PhoneNumber = "123-456-7890",
                              Address = new
                              {
                                  Street = "123 Main Rd",
                                  City = "Columbus",
                                  State = "Ohio"
                              }
                          }
                      }
                  };
                  _bucket.Upsert(doc);
       
                  var subDoc = _bucket.LookupIn<dynamic>("Foo::123").Exists("profile.address.state").Execute();
                  Console.WriteLine("Subdoc profile.address.state exists: " + subDoc.Exists("profile.address.state"));
       
                  var subDoc2 = _bucket.LookupIn<dynamic>("Foo::123").Exists("profile.address.province").Execute();
                  Console.WriteLine("Subdoc profile.address.province exists: " + subDoc2.Exists("profile.address.province"));
      }}
      

      Actual:
      The output I'm getting is:

      Subdoc profile.address.state exists: True
      Subdoc profile.address.province exists: True

      Expected
      I would expect profile.address.state to be True, but profile.address.province to be False.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          matthew.groves Matthew Groves created issue -
          pvarley Patrick Varley made changes -
          Field Original Value New Value
          Description *Summary*: This is major, assuming I'm doing it right. Whenever I use Exists on a subdocument, it always returns true, even if the path doesn't actually exist.

          *Example code*:

           {{ var doc = new Document<dynamic>
                      {
                          Id = "Foo::123",
                          Content = new
                          {
                              Username = "mgroves",
                              Profile = new
                              {
                                  PhoneNumber = "123-456-7890",
                                  Address = new
                                  {
                                      Street = "123 Main Rd",
                                      City = "Columbus",
                                      State = "Ohio"
                                  }
                              }
                          }
                      };
                      _bucket.Upsert(doc);

                      var subDoc = _bucket.LookupIn<dynamic>("Foo::123").Exists("profile.address.state").Execute();
                      Console.WriteLine("Subdoc profile.address.state exists: " + subDoc.Exists("profile.address.state"));

                      var subDoc2 = _bucket.LookupIn<dynamic>("Foo::123").Exists("profile.address.province").Execute();
                      Console.WriteLine("Subdoc profile.address.province exists: " + subDoc2.Exists("profile.address.province"));
          }}

          *Actual*:
          The output I'm getting is:

          Subdoc profile.address.state exists: True
          Subdoc profile.address.province exists: True

          *Expected*
          I would expect profile.address.state to be True, but profile.address.province to be False.
          *Summary*: This is major, assuming I'm doing it right. Whenever I use Exists on a subdocument, it always returns true, even if the path doesn't actually exist.

          *Example code*:

          {code:c#}

           {{ var doc = new Document<dynamic>
                      {
                          Id = "Foo::123",
                          Content = new
                          {
                              Username = "mgroves",
                              Profile = new
                              {
                                  PhoneNumber = "123-456-7890",
                                  Address = new
                                  {
                                      Street = "123 Main Rd",
                                      City = "Columbus",
                                      State = "Ohio"
                                  }
                              }
                          }
                      };
                      _bucket.Upsert(doc);

                      var subDoc = _bucket.LookupIn<dynamic>("Foo::123").Exists("profile.address.state").Execute();
                      Console.WriteLine("Subdoc profile.address.state exists: " + subDoc.Exists("profile.address.state"));

                      var subDoc2 = _bucket.LookupIn<dynamic>("Foo::123").Exists("profile.address.province").Execute();
                      Console.WriteLine("Subdoc profile.address.province exists: " + subDoc2.Exists("profile.address.province"));
          }}
          {code}

          *Actual*:
          The output I'm getting is:

          Subdoc profile.address.state exists: True
          Subdoc profile.address.province exists: True

          *Expected*
          I would expect profile.address.state to be True, but profile.address.province to be False.
          jmorris Jeff Morris made changes -
          Status New [ 10003 ] Open [ 1 ]
          jmorris Jeff Morris made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          jmorris Jeff Morris made changes -
          Fix Version/s 2.3.2 [ 13438 ]
          jmorris Jeff Morris made changes -
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Resolved [ 5 ]
          jmorris Jeff Morris made changes -
          Fix Version/s 2.3.3 [ 13439 ]
          Fix Version/s 2.3.2 [ 13438 ]

          People

            jmorris Jeff Morris
            matthew.groves Matthew Groves
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty