1

the document is like this:

{
"checkpointIds": [
"1155adc1-cb50-4124-9b5f-7667693a34c0" ,
"1155adc1-cb50-4124-9b5f-7667693a34c1"
] ,
"id":  "1a55dc34-bd30-4915-ada7-ce4972d5df4f"
}

i want to query documents that has specific values inside an attribute that is an array, i tried the bellow but it doesnt work, it returns simply all the results in the collection

filtered = list(r.table(collection).filter(
            lambda doc: \
                (doc['id'] == _filters.get('id')).default(False) | \
                (doc['checkpointIds'].set_intersection(_filters.get('checkpointIds'))).default(False)
).run(self.rdb_conn))
4

1 回答 1

1

这里:

filtered = list(r.table(collection).filter(
    lambda doc: \
        (doc['id'] == _filters.get('id')).default(False) | \
        (doc['checkpointIds'].set_intersection(_filters.get('checkpointIds')).is_empty().not_()).default(False)
).run(self.rdb_conn))
于 2015-03-25T19:59:51.207 回答