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

NA written as NULL and read back as NULL #79

Open
stanstrup opened this issue Mar 17, 2015 · 3 comments
Open

NA written as NULL and read back as NULL #79

stanstrup opened this issue Mar 17, 2015 · 3 comments
Labels

Comments

@stanstrup
Copy link

In a recent version NA values were set to write as NULL (see #44). This seem problematic to me.

when you read the data back bson NULL is converted back to R NULL which means you cannot use mongo.find.all with data.frame=TRUE because you cannot have NULL in your data.frame (length zero). Is there not a more proper bson NA? What was wrong with nan?

@dselivanov
Copy link
Owner

NaN - standing for not a number, is a numeric data type. And it is numeric type in mongodb too... The nearest analogue R's NA_* family is mongodb's null.
I think we can to try to convert mongodb's null to R's NA (add option like null_to_NA = TRUE). What do you think?

@stanstrup
Copy link
Author

That would work for me. I think it is the only way if we have 3 options in R (null/NA/NaN) but only 2 in mongo.

I guess null_to_NA has to default to FALSE but I guess it could make sense to set it to TRUE if data.frame=TRUE or throw a warning.

@ericwatt
Copy link

A flag to convert NULL to NA would be nice, I've run into this issue where values that were NA in R were written as NULL in mongo, and read back in as NULL in R. As mentioned above, this causes data.frame=TRUE to fail.

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

3 participants