socuments

Generate sample documents (MongoDB)

Usage no npm install needed!

<script type="module">
  import socuments from 'https://cdn.skypack.dev/socuments';
</script>

README

socuments

Make some wacky sci-fi themed sample documents, batteries included!

carbon (2)

Usage

const socuments = require("socuments");
const { writeFileSync } = require("fs");

const docs = socuments(100);

writeFileSync("./datadump.json", JSON.stringify(docs));

console.log(docs);

socuments ([ count, template]):

  • count: how many ya' want cheif?
  • template: a JSON template to use instead of the default.

Templates

Something like this.

{
  "foo": { "letters": 10 },
  "bar": { "letter": true },
  "baz": { "number": 10 },
  "qux": { "uuid": 24 },
  "quux": { "email": 12 },
  "corge": { "password": 24 },
  "grault": { "lorem": 126 },
  "garply": { "date": true },
  "waldo": { "boolean": 1 },
  "fred": { "bloodtype": true },
  "plugh": { "name": true }
}

For everything that supports integer values, the value represents the length. Setting letter to true capitalizes it. name and bloodtype have passthrough, so if you want presets, there you go!

Want more cool types? Open a PR!