1

I have a person object in RethinkDB that looks like this:

{
  "email": "user@domain.com", 
  "orders": {, 
    "id": 1,
    "additionalInvoices": [
      {
        "description": "Bananas", 
        "stripeChargeId": "ch_333"
      }, 
      {
        "description": "Apples", 
        "stripeChargeId": "ch_444"
      }
    ]
  }
}

Except no results are returned. Am I allowed to nest contains() functions? What's the best way to get the results I want?

Edit: I've also tried pluck() and describing the data structure, per this example of using nested datastructures in the RethinkDB docs - I thought this works, but it gives an empty object matching the query as the only result:

rethink.db(DATABASE).table(TABLE).pluck(
  {orders: [{additionalInvoices: [{'stripeChargeId': chargeID}]}]}
).run(dbConnection, function(err, results) {
  if ( err ) {
    cb(err)
    return;
  }
  toOne(results, cb)
})
thetaiko
  • 7,816
  • 2
  • 33
  • 49
mikemaccana
  • 110,530
  • 99
  • 389
  • 494

0 Answers0