ropensci / nodbi

Document DBI connector for R
https://docs.ropensci.org/nodbi
Other
76 stars 6 forks source link

docdb_get() with src_sqlite: Error in FUN(X[[i]], ...) : invalid multibyte string, element 1 #46

Closed rfhb closed 5 months ago

rfhb commented 5 months ago

Following the switch to JSONB for RSQLite as backend, a cast back to JSON is necessary but was missing in docdb_get.src_sqlite() once any docdb_update() has been applied to any document:

library(nodbi)
src <- src_sqlite()
key <- "myKey"
docdb_create(src = src, key = key, value = mtcars)
docdb_update(src = src, key = key, value = '{"vs": 77}', query = '{"gear": {"$in": [5,4]}}')
docdb_get(src = src, key = key)
# Error in FUN(X[[i]], ...) : invalid multibyte string, element 1