Reputation: 2162
During prototyping I have imported a bunch of Facebook posts into a table in batches. After the first batch I did a bulk update to convert the "created_date"
column from string to a native timestamp (using the handy r.ISO8601
function):
r.db('db').table('table').update({'created_date': r.ISO8601(r.row('created_date'))
On the second pass, when I try to repeat this update, the server throws an error because not all row fields are of type STRING
(ie the ones previously converted), which is what ISO861
expects.
I've already tried to filter on r.row('created_date').typeOf() == "STRING"
but got no matches. I can't find any other way to refer to the STRING type as an object rather than a literal string either.
I know that I could import these out and do the if/else logic in code, but I'm interested to understand if there's a native query that will filter out rows that match a certain type.
Upvotes: 0
Views: 31
Reputation: 2314
You have to use eq
for comparing like this:
r.row('created_date').typeOf().eq("STRING")
Using ==
only works on some language support operator overrding.
Upvotes: 2