Skip to content Skip to sidebar Skip to footer

How To Apply Greater Than Equal In Python Lambda Expression In Rethinkdb

I have below json record in RethinkDB table. [{ 'pid': 12, 'sk': [ { 'sid': 30, 'et': 3 }, { 'sid': 22, 'et': 10 },

Solution 1:

So you want to get all the documents where the sk array contains at least one document matching each predicate?

Does this do what you want?

r.table('cube7').filter(
  lambda row: r.and_(r.args(r.expr(skObj).map(
    lambda x: row['sk'].contains(
      lambda y: (y['sid'] == x['sid']) & (y['et'] >= x['et'])
    )
  )))
)

Post a Comment for "How To Apply Greater Than Equal In Python Lambda Expression In Rethinkdb"