tc / RMongo

R client to interface with MongoDB
102 stars 34 forks source link

rmongo doesn't handle correctly \r and \n characters #29

Open StefanoSpada opened 10 years ago

StefanoSpada commented 10 years ago

A collection in mongo containing special char as a value, such as \r\n ..., results in breaking the returned data frame.

e.g.

db.test.find() --- in mongo

{ "_id" : ObjectId("a_value"), "item" : "nospecial", "qty" : "15" }

{ "_id" : ObjectId("a_value"), "item" : "spec\r\r\nial", "qty" : "15" }

dataframe -- in R

                  X_id      item qty

1 a_value nospecial 15

2 a_valuer spec NA

3 ial 15 NA

tc commented 10 years ago

Thanks @StefanoSpada i added a failing unit test to https://github.com/tc/RMongo/tree/bug-fix/newline

Happy to accept any patch requests to pass the tests (R CMD check) :)