Cosmos 入门和文档 db/sql。为什么这不起作用?没有错误被抛出,我可以看到。有应该返回的数据。
private const string EndpointUri = "some url";
private const string PrimaryKey = "somekey";
private const string DbId = "People";
private const string CollectionId = "Person";
private DocumentClient client;
// GET: api/Person
[HttpGet]
public IEnumerable<Person> Get()
{
this.client = new DocumentClient(new Uri(EndpointUri), PrimaryKey);
FeedOptions queryOptions = new FeedOptions { MaxItemCount = 25, EnableCrossPartitionQuery = true };
IQueryable<Person> personQuery = this.client.CreateDocumentQuery<Person>(
UriFactory.CreateDocumentCollectionUri(DbId, CollectionId), queryOptions)
.Where(f => f.NameFirst != "Andersen");
List<Person> retVal = new List<Person>();
retVal = personQuery.ToList();
return retVal;
}