How come the Couchbase dotnet sdk doesn’t pull address1. It pulls correctly on Couchbase Console though.
It’s hard to say for certain without a copy of the query text you’re using. But at a guess, it appears that your .NET models are not in agreement with the JSON. The “address1” and other address properties are within a child object named address, which is within a “location” object. So you either need to perform a projection in the SELECT clause, or make your .NET models have properties that reference other objects like this:
public class Address
{
public string Address1 {get; set;}
public string Address2 {get; set;}
public string Address3 {get; set;}
public string Address4 {get; set;}
}
public class Location
{
public Address Address {get; set;}
public string Name {get; set;}
}
public class Profile
{
public Location Location {get; set;}
}
Please find the query that I use below:
var request = QueryRequest.Create(“SELECT META().id AS key
, TOOBJECT(hc) as value
FROM mybucket
as hc WHERE type=‘Profile’;”);
request.ScanConsistency(ScanConsistency.RequestPlus);
var response = _bucket.Query<KeyValuePair<string, Profile>>(request);
I even tried this query:
SELECT META().id AS key
, TOOBJECT(hc) as value
,location.address.address1,location.address.address2,location.address.address3,location.address.address4 FROM MyBucket
as hc WHERE type=‘Profile’;
It works perfect on Couchbase Console, but in dotnet sdk, it doesn’t show up newly added address columns
@rkbnair -
I suspect it’s a serialization issue as @btburnett3 suggested. If you can use Fiddler or another HTTP debugger and verify that the response matches the results from the console, that would help isolate the issue.
-Jeff