Skip to content

Commit bd5c978

Browse files
2 parents 48c3f65 + 2d9abe6 commit bd5c978

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

src/CouchDB.Driver/CouchContext.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ private static bool AreFieldsEqual(Dictionary<string, IndexFieldDirection> curre
204204
return true;
205205
}
206206

207-
private IEnumerable<PropertyInfo> GetDatabaseProperties() =>
207+
protected virtual IEnumerable<PropertyInfo> GetDatabaseProperties() =>
208208
GetType()
209209
.GetProperties(BindingFlags.Public | BindingFlags.Instance)
210210
.Where(p => p.PropertyType.IsGenericType &&

src/CouchDB.Driver/CouchDatabase.cs

+1
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ public async Task<List<TSource>> FindManyAsync(IReadOnlyCollection<string> docId
125125
var documents = bulkGetResult.Results
126126
.SelectMany(r => r.Docs)
127127
.Select(d => d.Item)
128+
.Where(i => i != null)
128129
.ToList();
129130

130131
foreach (TSource document in documents)

tests/CouchDB.Driver.UnitTests/Database_Tests.cs

+22
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,28 @@ public async Task FindMany()
8888
Assert.Equal("Leia", result[1].Name);
8989
}
9090

91+
[Fact]
92+
public async Task FindManyWithNotFoundError()
93+
{
94+
using var httpTest = new HttpTest();
95+
httpTest.RespondWith(@"{""results"":[{""id"":""1"",""docs"":[{""error"":{""id"":""1"",""rev"":""undefined"",""error"":""not_found"",""reason"":""missing""}}]}]}");
96+
var ids = new string[] { "1" };
97+
var result = await _rebels.FindManyAsync(ids);
98+
httpTest
99+
.ShouldHaveCalled("http://localhost/rebels/_bulk_get")
100+
.WithRequestJson(new
101+
{
102+
docs = new[]
103+
{
104+
new { id = "1" },
105+
}
106+
})
107+
.WithVerb(HttpMethod.Post);
108+
109+
Assert.NotNull(result);
110+
Assert.Empty(result);
111+
}
112+
91113
[Fact]
92114
public async Task Create()
93115
{

0 commit comments

Comments
 (0)