File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
src/WebJobs.Script/Binding
test/WebJobs.Script.Tests.Integration/TestScripts/Node/DocumentDBIn Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -68,18 +68,20 @@ public DocumentDBScriptBinding(ScriptBindingContext context) : base(context)
6868 {
6969 }
7070
71+ private string Id => Context . GetMetadataValue < string > ( "id" ) ;
72+
7173 public override Type DefaultType
7274 {
7375 get
7476 {
7577 if ( Context . Access == FileAccess . Read )
7678 {
77- if ( Context . Cardinality == "many" )
79+ if ( Id != null )
7880 {
79- return typeof ( JArray ) ;
81+ return typeof ( JObject ) ;
8082 }
8183
82- return typeof ( JObject ) ;
84+ return typeof ( JArray ) ;
8385 }
8486 else
8587 {
@@ -107,7 +109,7 @@ public override Collection<Attribute> GetAttributes()
107109
108110 attribute . CreateIfNotExists = Context . GetMetadataValue < bool > ( "createIfNotExists" ) ;
109111 attribute . ConnectionStringSetting = Context . GetMetadataValue < string > ( "connection" ) ;
110- attribute . Id = Context . GetMetadataValue < string > ( "id" ) ;
112+ attribute . Id = Id ;
111113 attribute . PartitionKey = Context . GetMetadataValue < string > ( "partitionKey" ) ;
112114 attribute . CollectionThroughput = Context . GetMetadataValue < int > ( "collectionThroughput" ) ;
113115 attribute . SqlQuery = Context . GetMetadataValue < string > ( "sqlQuery" ) ;
Original file line number Diff line number Diff line change 2020 "direction" : " in" ,
2121 "databaseName" : " ItemDb" ,
2222 "collectionName" : " ItemCollection" ,
23- "sqlQuery" : " SELECT f.id, f.related FROM f WHERE f.related = {documentId}" ,
24- "cardinality" : " many"
23+ "sqlQuery" : " SELECT f.id, f.related FROM f WHERE f.related = {documentId}"
2524 },
2625 {
2726 "type" : " documentDB" ,
You can’t perform that action at this time.
0 commit comments