我在azure宇宙数据库中的同一集合中设置了以下json文档:
videoData:
{
id: string,
url: string,
previewImage: string
}
videoDisplay
{
id: string,
width: number,
height: number,
videoDataId: string // points to id in videoData.id
}
我想在azure中执行一个sql查询,它将解析为看起来像这样的数组:
[
{
id: string //videoDisplay
width: number,
height: number,
videoData: videoData // videoDataId resolved to videoData which is now stored in video data
}
]
这可行吗?更重要的是,这将是我要解决的问题(将视频显示外键与视频数据绑定在一起)的合适解决方案。
答案 0 :(得分:1)
根据您的要求,我建议使用存储过程来合并您的文档。请参考我的工作步骤:
示例文档:
module grist_domain_types
implicit none
public :: aaa
type bbb
real (8), allocatable :: c(:)
end type bbb
type aaa
type(bbb), allocatable :: b(:)
end type aaa
end module grist_domain_types
program main
use grist_domain_types
type(aaa) :: a
integer(4) :: time,i
time=20
allocate(a%b(1:100000000))
call sleep(time)!--------------1
do i=1,100000000
allocate(a%b(i)%c(1:1))
enddo
call sleep(time)!--------------2
do i=1,100000000
deallocate(a%b(i)%c)
enddo
call sleep(time)!--------------3
deallocate(a%b)
call sleep(time)!--------------4
end program
存储过程代码:
[
{
"id": "1",
"url": "ad",
"previewImage": "sda"
},
{
"id": "string",
"width": "number",
"height": "number",
"videoDataId": "1"
},
{
"id": "string2",
"width": "number",
"height": "number",
"videoDataId": "2"
},
{
"id": "2",
"url": "ad",
"previewImage": "sda"
}
]
输出:
希望它对您有帮助。