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

Automatically converting String to BinData? #27

Closed
ryancole opened this issue Nov 8, 2012 · 1 comment
Closed

Automatically converting String to BinData? #27

ryancole opened this issue Nov 8, 2012 · 1 comment

Comments

@ryancole
Copy link

ryancole commented Nov 8, 2012

I know Monk is a wrapper around Mongoskin, which itself uses the -native API. I looked through the Monk code and did not see it explicitly doing this conversion, but I figured I'd ask here and work my way down the dependency list.

I have some code that stores a string, returned by one of the node crypto methods, into Mongo. With Monk, and Mongo 2.2.0, this seemed to automatically store that string as BinData in Mongo. Specifically, the string is a user password using the property name password. I guess I assumed that it was automatically being stored using BinData type, by one of the client modules. Today, I have tried out Mongo 2.2.1, and the string is no longer being stored as BinData, but instead is being stored in Mongo as a string.

Anyway, I doubt the conversion was being done based on the contents of the string, but most likely because of the property name being used, password. Either that, or the conversion was somehow being detected and done by MongoDB 2.2.0, and for whatever reason is not longer being done in 2.2.1.

Any ideas on whether or not this was being in Monk, or perhaps Mongoskin / the -native API?

@ryancole
Copy link
Author

ryancole commented Nov 8, 2012

Actually, you know what? It's Node causing this. The server running Mongo, and Monk, on which the password was being stored of BinData, is running Node 0.9.3. The server on which it's storing it as a string is running Node 0.8.14. In newer versions of Node, it looks like the crypto lib is changing to return buffers instead of strings, which is nice.

Sorry for the ticket!

@ryancole ryancole closed this as completed Nov 8, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant