1

I am new to RethinkDB and have looked here and elsewhere for the answer to this. I have found several things close, but still can't seem to figure out what seems like it should be simple. I have a query:

r.db('common').table("counters").filter({org: 'myorg'}).pluck('counters').run()

That gives the following results:

{
  "counters": [
    {
      "aid": 0 ,
      "pid": 1000 ,
      "rid": 0
    }
  ]
}

What I want is to pluck or somehow get a specific counter (e.g. pid). I tried counter[0].pid, counters.pid and a few others, but can't quite seem to find the magic bullet. From what I did find, I suspect this may involve a function, but am not sure where it should go. Any help is appreciated and if you dup this, please make sure it's an exact dup and not something close. Thanks!

1 Answer 1

1

OK, had to change the array to an object:

{
  "counters": {
    "aid": 0 ,
    "pid": 1000 ,
    "rid": 0
  }
}

... then use get(), this worksr.db('common').table("counters").get('12345-1234-54321-6666-f0dac0b6b68e')('counters')('pid')

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.