gpt4 book ai didi

python - Rethinkdb:从查询中返回多个对象

转载 作者:太空宇宙 更新时间:2023-11-04 03:12:11 25 4
gpt4 key购买 nike

我有一个表格,其中有些行如下所示:

{
"id": "12345"
"created_date": Fri May 27 2016 22:06:25 GMT+00:00 ,
"image": true

} {
"id": "6789"
"created_date": Mon May 30 2016 07:48:35 GMT+00:00 ,
"video": true

}{
"id": "12345"
"created_date": Fri May 21 2016 22:06:25 GMT+00:00 ,
"image": true

} {
"id": "6789"
"created_date": Mon May 6 2016 07:48:35 GMT+00:00 ,
"video": true

}
etc...

我想返回具有 "video":true 的最新(最新、最早日期)对象除此之外,我想返回具有 "image":true 的最新对象。

但是,我想在一个查询中执行此操作,因为这最终将在同一张表上完成。

理想的答案是:

[{
"id": "12345"
"created_date": Fri May 27 2016 22:06:25 GMT+00:00 ,
"image": true

}, {
"id": "6789"
"created_date": Mon May 30 2016 07:48:35 GMT+00:00 ,
"video": true

}]

有什么办法吗?

最佳答案

您可以通过编写类似于 r.expr([query1, query2]) 的内容来合并两个查询,它应该可以工作。

关于python - Rethinkdb:从查询中返回多个对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37665870/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com