Git Product home page Git Product logo

bsonparser's Introduction

BSON library

bsonparser is a library to help parsing BSON to JSON. It is written in C++ for performance purporses.

Overview

It parses all the common cases of BSON:

  • Double
  • UTF-8 string
  • Embedded document
  • Array
  • Binary
  • ObjectId
  • Boolean
  • UTC datetime
  • Null
  • 32-bit integer
  • Timestamp
  • 64-bit integer

Usage

To get the code, first clone this repository, then compile the code using make. The binary is generated in the bin folder along with some sample files.

Get The Code

$ git clone https://github.com/mcornejo/bsonparser
$ cd bsonparser
$ make 

Usage

There is a hardcoded test in the folder samples/. To test the library just run:

$ cd bin
$ ./bsonparser

Testing

Inside the samples/ folder there are other files to test the library which are copied automatically by the Makefile.

$ ./bsonparser <file>
$ ./bsonparser test.bson
$ ./bsonparser mongodump.airpair.tags.bson
$ ./bsonparser clerks.bson
$ ./bsonparser identities.bson
$ ./bsonparser jobs.bson

Internal

The BSON constructor takes as input a vector<char> and it contains two methods:

  • BSON::Parse(): This method parses the binary byte by byte. It does not iterate more than once over a BSON file once it is loaded into memory. It pushes each document found into a vector<Document>.

  • BSON::Dump(): This method prints the value of the BSON in JSON format in the terminal.

Importing to Xcode

The repository contains all the Xcode project files to import it easily.

Dependencies

This library relies on the RapidJSON library to store the parsed JSON. The version 1.1.0 of RapidJSON is along the code in the include folder.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.