bson 0.1.8 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +45 -1
  2. package/browser_build/bson.js +205 -176
  3. package/build/Release/bson.exp +0 -0
  4. package/build/Release/bson.lib +0 -0
  5. package/build/Release/bson.node +0 -0
  6. package/build/Release/bson.pdb +0 -0
  7. package/build/Release/obj/bson/bson.lastbuildstate +2 -0
  8. package/build/Release/obj/bson/bson.node.intermediate.manifest +10 -0
  9. package/build/Release/obj/bson/bson.obj +0 -0
  10. package/build/Release/obj/bson/bson.vcxprojResolveAssemblyReference.cache +0 -0
  11. package/build/Release/obj/bson/bson.write.1.tlog +3 -0
  12. package/build/Release/obj/bson/cl.command.1.tlog +0 -0
  13. package/build/Release/obj/bson/cl.read.1.tlog +0 -0
  14. package/build/Release/obj/bson/cl.write.1.tlog +0 -0
  15. package/build/Release/obj/bson/link.command.1.tlog +0 -0
  16. package/build/Release/obj/bson/link.read.1.tlog +0 -0
  17. package/build/Release/obj/bson/link.write.1.tlog +0 -0
  18. package/build/Release/obj/bson/mt.command.1.tlog +0 -0
  19. package/build/Release/obj/bson/mt.read.1.tlog +0 -0
  20. package/build/Release/obj/bson/mt.write.1.tlog +0 -0
  21. package/build/Release/obj/bson/vcwindows7.1sdk.pdb +0 -0
  22. package/build/binding.sln +21 -0
  23. package/build/bson.vcxproj +127 -0
  24. package/build/bson.vcxproj.filters +19 -0
  25. package/build/config.gypi +17 -8
  26. package/ext/bson.cc +68 -29
  27. package/ext/bson.h +9 -5
  28. package/ext/win32/ia32/bson.node +0 -0
  29. package/ext/win32/x64/bson.node +0 -0
  30. package/lib/bson/bson.js +192 -172
  31. package/lib/bson/objectid.js +4 -4
  32. package/package.json +2 -2
  33. package/benchmarks/benchmarks.js +0 -130
  34. package/build/Makefile +0 -355
  35. package/build/Release/.deps/Release/bson.node.d +0 -1
  36. package/build/Release/.deps/Release/obj.target/bson/ext/bson.o.d +0 -34
  37. package/build/Release/linker.lock +0 -0
  38. package/build/Release/obj.target/bson/ext/bson.o +0 -0
  39. package/build/binding.Makefile +0 -6
  40. package/build/bson.target.mk +0 -154
  41. package/build/gyp-mac-tool +0 -211
  42. package/test/browser/browser_example.htm +0 -19
  43. package/test/browser/bson_test.js +0 -260
  44. package/test/browser/nodeunit.js +0 -2034
  45. package/test/browser/suite2.js +0 -13
  46. package/test/browser/suite3.js +0 -7
  47. package/test/browser/test.html +0 -30
  48. package/test/node/bson_array_test.js +0 -240
  49. package/test/node/bson_parser_comparision_test.js +0 -493
  50. package/test/node/bson_test.js +0 -1694
  51. package/test/node/bson_typed_array_test.js +0 -392
  52. package/test/node/data/test_gs_weird_bug.png +0 -0
  53. package/test/node/test_full_bson.js +0 -315
  54. package/test/node/to_bson_test.js +0 -109
  55. package/test/node/tools/utils.js +0 -80
package/README.md CHANGED
@@ -1 +1,45 @@
1
- A JS/C++ Bson parser for node, used in the MongoDB Native driver
1
+ Javascript + C++ BSON parser
2
+ ============================
3
+
4
+ This BSON parser is primarily meant for usage with the `mongodb` node.js driver. However thanks to such wonderful tools at `onejs` we are able to package up a BSON parser that will work in the browser aswell. The current build is located in the `browser_build/bson.js` file.
5
+
6
+ A simple example on how to use it
7
+
8
+ <head>
9
+ <script src="https://raw.github.com/mongodb/js-bson/master/browser_build/bson.js">
10
+ </script>
11
+ </head>
12
+ <body onload="start();">
13
+ <script>
14
+ function start() {
15
+ var BSON = bson().BSON;
16
+ var Long = bson().Long;
17
+
18
+ var doc = {long: Long.fromNumber(100)}
19
+
20
+ // Serialize a document
21
+ var data = BSON.serialize(doc, false, true, false);
22
+ // De serialize it again
23
+ var doc_2 = BSON.deserialize(data);
24
+ }
25
+ </script>
26
+ </body>
27
+
28
+ It's got two simple methods to use in your application.
29
+
30
+ * BSON.serialize(object, checkKeys, asBuffer, serializeFunctions)
31
+ * @param {Object} object the Javascript object to serialize.
32
+ * @param {Boolean} checkKeys the serializer will check if keys are valid.
33
+ * @param {Boolean} asBuffer return the serialized object as a Buffer object **(ignore)**.
34
+ * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**
35
+ * @return {TypedArray/Array} returns a TypedArray or Array depending on what your browser supports
36
+
37
+ * BSON.deserialize(buffer, options, isArray)
38
+ * Options
39
+ * **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized.
40
+ * **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse.
41
+ * **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function.
42
+ * @param {TypedArray/Array} a TypedArray/Array containing the BSON data
43
+ * @param {Object} [options] additional options used for the deserialization.
44
+ * @param {Boolean} [isArray] ignore used for recursive parsing.
45
+ * @return {Object} returns the deserialized Javascript Object.