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)
68
68
{
69
69
}
70
70
71
+ private string Id => Context . GetMetadataValue < string > ( "id" ) ;
72
+
71
73
public override Type DefaultType
72
74
{
73
75
get
74
76
{
75
77
if ( Context . Access == FileAccess . Read )
76
78
{
77
- if ( Context . Cardinality == "many" )
79
+ if ( Id != null )
78
80
{
79
- return typeof ( JArray ) ;
81
+ return typeof ( JObject ) ;
80
82
}
81
83
82
- return typeof ( JObject ) ;
84
+ return typeof ( JArray ) ;
83
85
}
84
86
else
85
87
{
@@ -107,7 +109,7 @@ public override Collection<Attribute> GetAttributes()
107
109
108
110
attribute . CreateIfNotExists = Context . GetMetadataValue < bool > ( "createIfNotExists" ) ;
109
111
attribute . ConnectionStringSetting = Context . GetMetadataValue < string > ( "connection" ) ;
110
- attribute . Id = Context . GetMetadataValue < string > ( "id" ) ;
112
+ attribute . Id = Id ;
111
113
attribute . PartitionKey = Context . GetMetadataValue < string > ( "partitionKey" ) ;
112
114
attribute . CollectionThroughput = Context . GetMetadataValue < int > ( "collectionThroughput" ) ;
113
115
attribute . SqlQuery = Context . GetMetadataValue < string > ( "sqlQuery" ) ;
Original file line number Diff line number Diff line change 20
20
"direction" : " in" ,
21
21
"databaseName" : " ItemDb" ,
22
22
"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}"
25
24
},
26
25
{
27
26
"type" : " documentDB" ,
You can’t perform that action at this time.
0 commit comments