meteor/js-bson

Name: js-bson

Owner: Meteor

Description: null

Created: 2013-07-18 17:53:54.0

Updated: 2015-03-04 00:14:14.0

Pushed: 2015-02-07 01:50:58.0

Homepage: null

Size: 786

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Javascript + C++ BSON parser

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.

A simple example on how to use it

<head>
  <script src="https://raw.github.com/mongodb/js-bson/master/browser_build/bson.js">
  </script>
</head>
<body onload="start();">
<script>
  function start() {
    var BSON = bson().BSON;
    var Long = bson().Long;

    var doc = {long: Long.fromNumber(100)}

    // Serialize a document
    var data = BSON.serialize(doc, false, true, false);
    // De serialize it again
    var doc_2 = BSON.deserialize(data);
  }
</script>
</body>

It's got two simple methods to use in your application.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.