mongodb-schema-parser

MongoDB Schema Analysis

This package is deprecated. Please use @mongodb-rust/wasm-schema-parser
Last updated 2 years ago by lrlna .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install mongodb-schema-parser 
SYNC missed versions from official npm registry.

mongodb-schema-parser

crates.io version build status downloads docs.rs docs

Infer a probabilistic schema for a MongoDB collection. This library is meant to be used in Rust or as Web Assembly module in JavaScript.

Usage: in Rust

use SchemaParser

pub fn main () {
  let mut file = fs::read_to_string("examples/fanclub.json").unwrap();
  let file: Vec<&str> = file.split("\n").collect();
  let schema_parser = SchemaParser::new();
  for json in file {
    schema_parser.write(&json)?;
  }
  let result = schema_parser.read();
  println!("{:?}", result);
}

Usage: in JavaScript

Make sure your environment is setup for Web Assembly usage.

import { SchemaParser } from "mongodb-schema-parser";

const schemaParser = new SchemaParser()

// get the json file
fetch('./fanclub.json')
  .then(response => response.text())
  .then(data => {
    var json = data.split("\n")
    for (var i = 0; i < json.length; i++) {
      if (json[i] !== '') {
        // feed the parser json line by line
        schemaParser.write(json[i])
      }
    }
    // get the result as a json string
    var result = schemaParser.toJson()
    console.log(result)
  })

Installation

$ cargo add mongodb-schema-parser 

License

Apache-2.0

Current Tags

  • 0.1.10                                ...           latest (2 years ago)

11 Versions

  • 0.1.10 [deprecated]           ...           2 years ago
  • 0.1.9                                ...           2 years ago
  • 0.1.8                                ...           2 years ago
  • 0.1.7                                ...           2 years ago
  • 0.1.6                                ...           2 years ago
  • 0.1.5                                ...           2 years ago
  • 0.1.4                                ...           2 years ago
  • 0.1.3                                ...           2 years ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 5
Dependencies (0)
None
Dev Dependencies (0)
None

Copyright 2014 - 2017 © taobao.org |