Skip to content
Browse files

NCBC-154: Map id from view row to domain object Id

Change-Id: I4d54a6f909acecf1001d9287ba5d1a7dc16ae132
Reviewed-on: http://review.couchbase.org/22514
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: John C. Zablocki <john@couchbase.com>
  • Loading branch information...
1 parent a520597 commit d4f8de4fde4a33a1c1eccd638a5ccd51a6afca05 @johnzablocki johnzablocki committed with John C. Zablocki
View
21 src/Couchbase.Tests/CouchbaseClientGenericViewTests.cs
@@ -41,27 +41,6 @@ public void When_Should_Lookup_By_Id_Is_False_Document_Is_Deserialized_By_Proper
Assert.That(view.Count(), Is.GreaterThan(0), "View count was 0");
}
-
- private class City
- {
- [JsonProperty("_id")]
- public string Id { get; set; }
-
- [JsonProperty("name")]
- public string Name { get; set; }
-
- [JsonProperty("state")]
- public string State { get; set; }
-
- [JsonProperty("type")]
- public string Type { get; set; }
- }
-
- private class CityProjection
- {
- [JsonProperty("cityState")]
- public string CityState { get; set; }
- }
}
}
View
5 src/Couchbase.Tests/CouchbaseClientViewTestsBase.cs
@@ -80,22 +80,17 @@ protected void CreateDocsFromFile(string docFile, string keyPrefix, params strin
protected class City
{
- [JsonProperty("_id")]
public string Id { get; set; }
- [JsonProperty("name")]
public string Name { get; set; }
- [JsonProperty("state")]
public string State { get; set; }
- [JsonProperty("type")]
public string Type { get; set; }
}
protected class CityProjection
{
- [JsonProperty("cityState")]
public string CityState { get; set; }
}
}
View
4 src/Couchbase/Helpers/DocHelper.cs
@@ -9,9 +9,9 @@ public static class DocHelper
{
public static string InsertId(string json, string id)
{
- if (!json.Contains("\"_id\""))
+ if (!json.Contains("\"id\""))
{
- return json.Insert(1, string.Concat("\"_id\":", "\"", id, "\","));
+ return json.Insert(1, string.Concat("\"id\":", "\"", id, "\","));
}
return json;
}

0 comments on commit d4f8de4

Please sign in to comment.
Something went wrong with that request. Please try again.