public void createJsonIndexNamedDdoc() { var sortItem = new SortField(); sortItem.name = "foo"; sortItem.sort = Sort.asc; var fields = new List<SortField>() { sortItem }; var task = db.CreateJsonIndexAsync(fields: fields, designDocumentName: "myddoc"); task.Wait(); Assert.IsFalse(task.IsFaulted); }
private void doQuerySetup() { var indexField = new SortField() { name = ageKey }; ageIndexFields.Add(indexField); doQuerySetupWithFields(ageIndex, ageIndexFields); }
public void testSkipQueryTest() { doQuerySetup(); var sortField = new SortField(); sortField.name = ageKey; var task = db.QueryAsync(selector: new Dictionary<string,object>() { [ageKey ] = new Dictionary<string,int>() { ["$gt" ] = 10 } }, skip: 5); task.Wait(); IList<DocumentRevision> result = task.Result; Assert.False(task.IsFaulted, "findByIndex() failed"); Assert.IsNotNull(task.Result, "Query result was null"); Assert.True(result.Count == 4); foreach (DocumentRevision revision in result) { Object age; revision.body.TryGetValue(ageKey, out age); Assert.True((long)age > 10); } }
public void testGreaterThanQueryWithSortOptionTest() { doQuerySetup(); var sortField = new SortField(); sortField.name = ageKey; sortField.sort = Sort.desc; var task = db.QueryAsync(selector: new Dictionary<string,object>() { [ageKey ] = new Dictionary<string,int>() { ["$gt" ] = 1 } }, sort: new List<SortField>() { sortField }); task.Wait(); IList<DocumentRevision> result = task.Result; Assert.False(task.IsFaulted, "findByIndex() failed"); Assert.IsNotNull(task.Result, "Query result was null"); Assert.True(result.Count == 18); DocumentRevision revision = result[0]; Object age; revision.body.TryGetValue(ageKey, out age); Assert.True((long)age == 19); }
public void testEqualityQueryTest() { doQuerySetup(); var sortField = new SortField(){ sort = Sort.desc, name = ageKey }; var task = db.QueryAsync(selector: new Dictionary<string,object>() { [ageKey ] = 5 }, sort: new List<SortField>() { sortField }); task.Wait(); IList<DocumentRevision> result = task.Result; Assert.False(task.IsFaulted, "findByIndex() failed"); Assert.IsNotNull(task.Result, "Query result was null"); Assert.True(result.Count == 1); DocumentRevision revision = result[0]; Object age; revision.body.TryGetValue(ageKey, out age); Assert.True((long)age == 5); }
public void createJsonIndexOnlyRequired() { var sortItem = new SortField(); sortItem.name = "foo"; sortItem.sort = Sort.asc; var fields = new List<SortField>() { sortItem }; var task = db.CreateJsonIndexAsync(fields: fields); task.Wait(); Assert.IsFalse(task.IsFaulted); }