asp.net - .NET - c# - Cross partition query is required but disabled trouble on DocumentDB data access -
i have written following code fetch record document db {private static void querydocuments1(documentclient client) {
iqueryable<searchinput> queryable = client.createdocumentquery<searchinput>(urifactory.createdocumentcollectionuri(documentdbname, documentdbcollectionname)) .where(x => x.receiver == "8907180"); list<searchinput> posts = queryable.tolist(); }}
and showing following error on code line list posts = queryable.tolist();
{"cross partition query required disabled. please set x-ms-documentdb-query-enablecrosspartition true, specify x-ms-documentdb-partitionkey, or revise query avoid exception.\r\nactivityid: xxxxxx-xxxx-xxx-xxx-xxxxxxx"}
please me on it...
you should use createdocumentquery method feedoptions object parameter, , class has property x-ms-documentdb-query-enablecrosspartition name enablecrosspartitionquery. please follow links https://msdn.microsoft.com/library/en-us/dn850285.aspx rest https://docs.microsoft.com/en-us/rest/api/documentdb/querying-documentdb-resources-using-the-rest-api
Comments
Post a Comment