Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

db_query with a single field specification does not work #63

Closed
ghost opened this issue Nov 29, 2017 · 3 comments
Closed

db_query with a single field specification does not work #63

ghost opened this issue Nov 29, 2017 · 3 comments
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Nov 29, 2017

If I just want to pull a single field from all documents matching a query, there currently does not seem to be a working approach.

db_query(myConn, 'mydb', selector = list(`_id` = list(`$gt` = NULL)), fields = '_id', limit = 2)
Error: (400) - Fields must be an array of strings, not: <<95,105,100>>

db_query(myConn, 'mydb', selector = list(`_id` = list(`$gt` = NULL)), fields = c('_id'), limit = 2)
Error: (400) - Fields must be an array of strings, not: <<95,105,100>>

Whereas, this works:

db_query(myConn, 'mydb', selector = list(`_id` = list(`$gt` = NULL)), fields = c('_id', '_rev'), limit = 2)

Of course, the workaround is to provide some random additional field, retrieve both fields from Cloudant, write an lapply function to then dump the random additional field from the output. While this is a workaround for now, it will be nice for the code to work as expected.

BTW - single field works just fine in Python with the corresponding module. :)

@sckott sckott added this to the v0.3 milestone Nov 29, 2017
@sckott sckott added the bug label Nov 29, 2017
@sckott
Copy link
Contributor

sckott commented Nov 29, 2017

thanks for the report @tumulurig3 , will look into this

@sckott sckott closed this as completed in d296fee Nov 29, 2017
@sckott
Copy link
Contributor

sckott commented Nov 29, 2017

@tumulurig3 try again after reinstalling devtools::install_github("ropensci/sofa")

@ghost
Copy link
Author

ghost commented Nov 29, 2017

Works perfectly! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant