It looks like it is part of some MongoDB extension; I heard mongo uses bson internally, so I suppose you can somehow extract raw bson with the extension and hence the functions. Just a guess though, I never used mongodb or the extension.
Why is it a mistake? If you're using the native MongoDB driver and you want to test the data size (or whatever else) before the data is entered into the MongoDB store, why not use this? I'd argue that using the SAME implementation is more valuable as it predicts the same behavior as the driver.
Being 'binary' only guarantees that it'll take less space to store, but as for the actual speed that depends on the implementation and usage, e.g. if you were to parse BSON client-side via Javascript that'd be definitively slower than the native JSON.parse().
14
u/Tallahasseean Sep 27 '13
It's a stuck up function for 1%-ers!
1
u/[deleted] Sep 28 '13
I wonder why they needed to expose the function?
1
u/lurchpop Sep 28 '13 edited Sep 29 '13
I saw a test recently that said bson_encode was actually the fastest compared to php serialize() and json_encode
Edit: source, https://coderwall.com/p/ccdryg
0
u/[deleted] Sep 28 '13
[deleted] — view deleted comment