mongodb-js / dataset-generator Goto Github PK
View Code? Open in Web Editor NEW:construction: What's a database without any data?
Home Page: https://github.com/mongodb-js/dataset-generator
License: MIT License
:construction: What's a database without any data?
Home Page: https://github.com/mongodb-js/dataset-generator
License: MIT License
With numbers in string format, queries using commands such "$gt" would be futile. The package should support inserting various BSON types or extend JSON types to mongodb.
After npm install -g mongodb-datasets
, any use of mongodb-datasets
return such error.
http://docs.mongodb.org/manual/applications/data-models-tree-structures/
This will require:
Now that we have completed #26, we're ready to integrate -datasets into mongoscope! Because mongoscope-server has to manage all of the connections, we'll need to decouple from the mongo driver here.
populator.js
and operations/mongo.js
A TransformStream takes a ReadableStream + configuration and emits the transformed result. Consider the following bash expressions
cat user-schema.json | mongodb-datasets -n 10 > user-data.json
mongodb-datasets -n 10 < user-schema.json > user-data.json
mongodb-datasets -n 10 < user-schema.json > mongodb-importer mongodb://localhost:27017/demo.users --
export TOKEN=`curl -X POST http://localhost:29017/api/v1/token -d seed="localhost:27017" -H "Accept: text/plain"`;
mongodb-datasets -n 10 < user-schema.json > curl -X POST http://localhost:29017/api/v1/import/demo.users -H "Authorization: Bearer ${TOKEN}"
What we're doing in everyone of these cases is exactly the same: inserting mongodb-datasets as a transform! And because transform streams are just plumbing, adding support for this means all of the above are trivial.
The simplest way to test:
var fs = require('fs'),
md = require('mongodb-datasets');
fs.createReadStream('./examples/user-schema.json')
.pipe(md.createGeneratorStream(10))
.pipe(fs.createWriteStream('./examples/user-data.json');
After #10 #11 #12 are complete, generate a reasonable set size (~1000 documents), run mongoexport for each subsection of the docs the schemas map to (so 10 tarballs in total), and upload them to a release of mongodb-datasets. We'll then coordinate with the docs team for integration of these into the public docs.mongodb.org.
employees: [ "{{_$config}}", {size: "{{this.numOfEmployees}}"}, "{{name()}}" ]
.[ "{{_$config}}", { size: 2, enum: ['a', 'b', 'c'] }, "{{enum}}" ]
may produce ['b', 'a']
For now, all the generated content is in string format, whereas ISODate is a very useful datatype for MongoDB users. We need a way to generate Date object so that it is stored as ISODate in db.
The docs define 3 examples for modeling relationships between documents, detailed here http://docs.mongodb.org/manual/applications/data-models-relationships/.
as discussed, how could we support
Concretely, the following template produces { doc: { counter: 0 }, wrong: 1 }
{
"doc": {
"counter": "{{Double(counter())}}"
},
"wrong": "{{this.doc.counter}}"
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.