UNPKG

mongoose-data-seed

Version:

Seed mongodb with data using mongoose models

1,760 lines 61.4 kB
{ "type": "File", "start": 0, "end": 606, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 22, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 606, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 22, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 48, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 48 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 22, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 22 } }, "local": { "type": "Identifier", "start": 7, "end": 22, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 22 }, "identifierName": "commandLineArgs" }, "name": "commandLineArgs" } } ], "source": { "type": "StringLiteral", "start": 28, "end": 47, "loc": { "start": { "line": 1, "column": 28 }, "end": { "line": 1, "column": 47 } }, "extra": { "rawValue": "command-line-args", "raw": "'command-line-args'" }, "value": "command-line-args" } }, { "type": "ImportDeclaration", "start": 50, "end": 103, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 53 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 57, "end": 74, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 24 } }, "local": { "type": "Identifier", "start": 57, "end": 74, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 24 }, "identifierName": "optionDefinitions" }, "name": "optionDefinitions" } } ], "source": { "type": "StringLiteral", "start": 80, "end": 102, "loc": { "start": { "line": 3, "column": 30 }, "end": { "line": 3, "column": 52 } }, "extra": { "rawValue": "./option-definitions", "raw": "'./option-definitions'" }, "value": "./option-definitions" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Get run options from argv or prompts\n * @param {string[]} argv cli argv\n * @return {Object} run options\n * @property {string[]} selectedSeeders\n * @property {boolean} dropDatabase\n * @property {boolean} helpWanted\n ", "start": 105, "end": 369, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 12, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "start": 370, "end": 605, "loc": { "start": { "line": 13, "column": 0 }, "end": { "line": 21, "column": 2 } }, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", "start": 377, "end": 605, "loc": { "start": { "line": 13, "column": 7 }, "end": { "line": 21, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", "start": 383, "end": 604, "loc": { "start": { "line": 13, "column": 13 }, "end": { "line": 21, "column": 1 } }, "id": { "type": "Identifier", "start": 383, "end": 393, "loc": { "start": { "line": 13, "column": 13 }, "end": { "line": 13, "column": 23 }, "identifierName": "getOptions" }, "name": "getOptions", "leadingComments": null }, "init": { "type": "ArrowFunctionExpression", "start": 396, "end": 604, "loc": { "start": { "line": 13, "column": 26 }, "end": { "line": 21, "column": 1 } }, "id": { "type": "Identifier", "start": 383, "end": 393, "loc": { "start": { "line": 13, "column": 13 }, "end": { "line": 13, "column": 23 }, "identifierName": "getOptions" }, "name": "getOptions", "leadingComments": null }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 396, "end": 400, "loc": { "start": { "line": 13, "column": 26 }, "end": { "line": 13, "column": 30 }, "identifierName": "argv" }, "name": "argv" } ], "body": { "type": "BlockStatement", "start": 404, "end": 604, "loc": { "start": { "line": 13, "column": 34 }, "end": { "line": 21, "column": 1 } }, "body": [ { "type": "VariableDeclaration", "start": 408, "end": 545, "loc": { "start": { "line": 14, "column": 2 }, "end": { "line": 18, "column": 51 } }, "declarations": [ { "type": "VariableDeclarator", "start": 414, "end": 544, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 18, "column": 50 } }, "id": { "type": "ObjectPattern", "start": 414, "end": 497, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 18, "column": 3 } }, "properties": [ { "type": "ObjectProperty", "start": 420, "end": 444, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 28 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 420, "end": 427, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 11 }, "identifierName": "seeders" }, "name": "seeders" }, "value": { "type": "Identifier", "start": 429, "end": 444, "loc": { "start": { "line": 15, "column": 13 }, "end": { "line": 15, "column": 28 }, "identifierName": "selectedSeeders" }, "name": "selectedSeeders" } }, { "type": "ObjectProperty", "start": 450, "end": 470, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 24 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 450, "end": 456, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 10 }, "identifierName": "dropdb" }, "name": "dropdb" }, "value": { "type": "Identifier", "start": 458, "end": 470, "loc": { "start": { "line": 16, "column": 12 }, "end": { "line": 16, "column": 24 }, "identifierName": "dropDatabase" }, "name": "dropDatabase" } }, { "type": "ObjectProperty", "start": 476, "end": 492, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 20 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 476, "end": 480, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 8 }, "identifierName": "help" }, "name": "help" }, "value": { "type": "Identifier", "start": 482, "end": 492, "loc": { "start": { "line": 17, "column": 10 }, "end": { "line": 17, "column": 20 }, "identifierName": "helpWanted" }, "name": "helpWanted" } } ] }, "init": { "type": "CallExpression", "start": 500, "end": 544, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 50 } }, "callee": { "type": "Identifier", "start": 500, "end": 515, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 21 }, "identifierName": "commandLineArgs" }, "name": "commandLineArgs" }, "arguments": [ { "type": "Identifier", "start": 516, "end": 533, "loc": { "start": { "line": 18, "column": 22 }, "end": { "line": 18, "column": 39 }, "identifierName": "optionDefinitions" }, "name": "optionDefinitions" }, { "type": "ObjectExpression", "start": 535, "end": 543, "loc": { "start": { "line": 18, "column": 41 }, "end": { "line": 18, "column": 49 } }, "properties": [ { "type": "ObjectProperty", "start": 537, "end": 541, "loc": { "start": { "line": 18, "column": 43 }, "end": { "line": 18, "column": 47 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 537, "end": 541, "loc": { "start": { "line": 18, "column": 43 }, "end": { "line": 18, "column": 47 }, "identifierName": "argv" }, "name": "argv" }, "value": { "type": "Identifier", "start": 537, "end": 541, "loc": { "start": { "line": 18, "column": 43 }, "end": { "line": 18, "column": 47 }, "identifierName": "argv" }, "name": "argv" }, "extra": { "shorthand": true } } ] } ] } } ], "kind": "const" }, { "type": "ReturnStatement", "start": 549, "end": 602, "loc": { "start": { "line": 20, "column": 2 }, "end": { "line": 20, "column": 55 } }, "argument": { "type": "ObjectExpression", "start": 556, "end": 601, "loc": { "start": { "line": 20, "column": 9 }, "end": { "line": 20, "column": 54 } }, "properties": [ { "type": "ObjectProperty", "start": 558, "end": 573, "loc": { "start": { "line": 20, "column": 11 }, "end": { "line": 20, "column": 26 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 558, "end": 573, "loc": { "start": { "line": 20, "column": 11 }, "end": { "line": 20, "column": 26 }, "identifierName": "selectedSeeders" }, "name": "selectedSeeders" }, "value": { "type": "Identifier", "start": 558, "end": 573, "loc": { "start": { "line": 20, "column": 11 }, "end": { "line": 20, "column": 26 }, "identifierName": "selectedSeeders" }, "name": "selectedSeeders" }, "extra": { "shorthand": true } }, { "type": "ObjectProperty", "start": 575, "end": 587, "loc": { "start": { "line": 20, "column": 28 }, "end": { "line": 20, "column": 40 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 575, "end": 587, "loc": { "start": { "line": 20, "column": 28 }, "end": { "line": 20, "column": 40 }, "identifierName": "dropDatabase" }, "name": "dropDatabase" }, "value": { "type": "Identifier", "start": 575, "end": 587, "loc": { "start": { "line": 20, "column": 28 }, "end": { "line": 20, "column": 40 }, "identifierName": "dropDatabase" }, "name": "dropDatabase" }, "extra": { "shorthand": true } }, { "type": "ObjectProperty", "start": 589, "end": 599, "loc": { "start": { "line": 20, "column": 42 }, "end": { "line": 20, "column": 52 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 589, "end": 599, "loc": { "start": { "line": 20, "column": 42 }, "end": { "line": 20, "column": 52 }, "identifierName": "helpWanted" }, "name": "helpWanted" }, "value": { "type": "Identifier", "start": 589, "end": 599, "loc": { "start": { "line": 20, "column": 42 }, "end": { "line": 20, "column": 52 }, "identifierName": "helpWanted" }, "name": "helpWanted" }, "extra": { "shorthand": true } } ] } } ], "directives": [] } }, "leadingComments": null } ], "kind": "const", "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Get run options from argv or prompts\n * @param {string[]} argv cli argv\n * @return {Object} run options\n * @property {string[]} selectedSeeders\n * @property {boolean} dropDatabase\n * @property {boolean} helpWanted\n ", "start": 105, "end": 369, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 12, "column": 3 } } } ], "trailingComments": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Get run options from argv or prompts\n * @param {string[]} argv cli argv\n * @return {Object} run options\n * @property {string[]} selectedSeeders\n * @property {boolean} dropDatabase\n * @property {boolean} helpWanted\n ", "start": 105, "end": 369, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 12, "column": 3 } } } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": "*\n * Get run options from argv or prompts\n * @param {string[]} argv cli argv\n * @return {Object} run options\n * @property {string[]} selectedSeeders\n * @property {boolean} dropDatabase\n * @property {boolean} helpWanted\n ", "start": 105, "end": 369, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 12, "column": 3 } } } ], "tokens": [ { "type": { "label": "import", "keyword": "import", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "import", "start": 0, "end": 6, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 6 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "commandLineArgs", "start": 7, "end": 22, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 22 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "from", "start": 23, "end": 27, "loc": { "start": { "line": 1, "column": 23 }, "end": { "line": 1, "column": 27 } } }, { "type": { "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "command-line-args", "start": 28, "end": 47, "loc": { "start": { "line": 1, "column": 28 }, "end": { "line": 1, "column": 47 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 47, "end": 48, "loc": { "start": { "line": 1, "column": 47 }, "end": { "line": 1, "column": 48 } } }, { "type": { "label": "import", "keyword": "import", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "import", "start": 50, "end": 56, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 6 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "optionDefinitions", "start": 57, "end": 74, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 24 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "from", "start": 75, "end": 79, "loc": { "start": { "line": 3, "column": 25 }, "end": { "line": 3, "column": 29 } } }, { "type": { "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "./option-definitions", "start": 80, "end": 102, "loc": { "start": { "line": 3, "column": 30 }, "end": { "line": 3, "column": 52 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 102, "end": 103, "loc": { "start": { "line": 3, "column": 52 }, "end": { "line": 3, "column": 53 } } }, { "type": "CommentBlock", "value": "*\n * Get run options from argv or prompts\n * @param {string[]} argv cli argv\n * @return {Object} run options\n * @property {string[]} selectedSeeders\n * @property {boolean} dropDatabase\n * @property {boolean} helpWanted\n ", "start": 105, "end": 369, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 12, "column": 3 } } }, { "type": { "label": "export", "keyword": "export", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "export", "start": 370, "end": 376, "loc": { "start": { "line": 13, "column": 0 }, "end": { "line": 13, "column": 6 } } }, { "type": { "label": "const", "keyword": "const", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "const", "start": 377, "end": 382, "loc": { "start": { "line": 13, "column": 7 }, "end": { "line": 13, "column": 12 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "getOptions", "start": 383, "end": 393, "loc": { "start": { "line": 13, "column": 13 }, "end": { "line": 13, "column": 23 } } }, { "type": { "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "=", "start": 394, "end": 395, "loc": { "start": { "line": 13, "column": 24 }, "end": { "line": 13, "column": 25 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "argv", "start": 396, "end": 400, "loc": { "start": { "line": 13, "column": 26 }, "end": { "line": 13, "column": 30 } } }, { "type": { "label": "=>", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 401, "end": 403, "loc": { "start": { "line": 13, "column": 31 }, "end": { "line": 13, "column": 33 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 404, "end": 405, "loc": { "start": { "line": 13, "column": 34 }, "end": { "line": 13, "column": 35 } } }, { "type": { "label": "const", "keyword": "const", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "const", "start": 408, "end": 413, "loc": { "start": { "line": 14, "column": 2 }, "end": { "line": 14, "column": 7 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 414, "end": 415, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 9 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "seeders", "start": 420, "end": 427, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 11 } } }, { "type": { "label": ":", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 427, "end": 428, "loc": { "start": { "line": 15, "column": 11 }, "end": { "line": 15, "column": 12 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "selectedSeeders", "start": 429, "end": 444, "loc": { "start": { "line": 15, "column": 13 }, "end": { "line": 15, "column": 28 } } }, { "type": { "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 444, "end": 445, "loc": { "start": { "line": 15, "column": 28 }, "end": { "line": 15, "column": 29 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "dropdb", "start": 450, "end": 456, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 10 } } }, { "type": { "label": ":", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 456, "end": 457, "loc": { "start": { "line": 16, "column": 10 }, "end": { "line": 16, "column": 11 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "dropDatabase", "start": 458, "end": 470, "loc": { "start": { "line": 16, "column": 12 }, "end": { "line": 16, "column": 24 } } }, { "type": { "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 470, "end": 471, "loc": { "start": { "line": 16, "column": 24 }, "end": { "line": 16, "column": 25 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "help", "start": 476, "end": 480, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 8 } } }, { "type": { "label": ":", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 480, "end": 481, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 9 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "helpWanted", "start": 482, "end": 492, "loc": { "start": { "line": 17, "column": 10 }, "end": { "line": 17, "column": 20 } } }, { "type": { "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 492, "end": 493, "loc": { "start": { "line": 17, "column": 20 }, "end": { "line": 17, "column": 21 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 496, "end": 497