flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
1
VISUALIZACION/node_modules/mongod/.coveralls.yml
generated
vendored
Executable file
1
VISUALIZACION/node_modules/mongod/.coveralls.yml
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
repo_token: fZxXIxWDSeLMujsqlTSivCxD9Nymg3xwM
|
||||
86
VISUALIZACION/node_modules/mongod/.eslintrc.yml
generated
vendored
Executable file
86
VISUALIZACION/node_modules/mongod/.eslintrc.yml
generated
vendored
Executable file
|
|
@ -0,0 +1,86 @@
|
|||
env:
|
||||
es6: true
|
||||
node: true
|
||||
extends: 'eslint:recommended'
|
||||
parserOptions:
|
||||
ecmaVersion: 6
|
||||
rules:
|
||||
indent:
|
||||
- error
|
||||
- 2
|
||||
- SwitchCase: 1
|
||||
linebreak-style:
|
||||
- error
|
||||
- unix
|
||||
quotes:
|
||||
- error
|
||||
- single
|
||||
semi:
|
||||
- error
|
||||
- always
|
||||
eqeqeq:
|
||||
- error
|
||||
- smart
|
||||
key-spacing:
|
||||
- error
|
||||
keyword-spacing:
|
||||
- error
|
||||
handle-callback-err:
|
||||
- error
|
||||
comma-dangle:
|
||||
- error
|
||||
yoda:
|
||||
- error
|
||||
no-trailing-spaces:
|
||||
- error
|
||||
no-case-declarations:
|
||||
- error
|
||||
no-new-wrappers:
|
||||
- error
|
||||
no-new:
|
||||
- error
|
||||
no-multi-spaces:
|
||||
- error
|
||||
no-lone-blocks:
|
||||
- error
|
||||
no-multiple-empty-lines:
|
||||
- error
|
||||
- max: 1
|
||||
maxEOF: 0
|
||||
semi-spacing:
|
||||
- error
|
||||
spaced-comment:
|
||||
- error
|
||||
- always
|
||||
unicode-bom:
|
||||
- error
|
||||
- never
|
||||
one-var:
|
||||
- error
|
||||
- never
|
||||
newline-per-chained-call:
|
||||
- error
|
||||
- ignoreChainWithDepth: 2
|
||||
newline-before-return:
|
||||
- error
|
||||
require-jsdoc:
|
||||
- error
|
||||
- require:
|
||||
FunctionDeclaration: true
|
||||
MethodDefinition: true
|
||||
ClassDeclaration: true
|
||||
ArrowFunctionExpression: true
|
||||
valid-jsdoc:
|
||||
- error
|
||||
- prefer:
|
||||
arg: argument
|
||||
param: argument
|
||||
returns: return
|
||||
preferType:
|
||||
object: Object
|
||||
string: String
|
||||
boolean: Boolean
|
||||
bool: Boolean
|
||||
number: Number
|
||||
requireParamDescription: false
|
||||
requireReturnDescription: false
|
||||
7
VISUALIZACION/node_modules/mongod/.npmignore
generated
vendored
Executable file
7
VISUALIZACION/node_modules/mongod/.npmignore
generated
vendored
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
node_modules
|
||||
coverage
|
||||
out
|
||||
data
|
||||
.DS_Store
|
||||
*.conf
|
||||
*.log
|
||||
25
VISUALIZACION/node_modules/mongod/.travis.yml
generated
vendored
Executable file
25
VISUALIZACION/node_modules/mongod/.travis.yml
generated
vendored
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- '4.0'
|
||||
- '4'
|
||||
- '5'
|
||||
- '6.0'
|
||||
- '6'
|
||||
- '7'
|
||||
sudo: required
|
||||
before_install:
|
||||
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
|
||||
- echo "deb [ arch=amd64 ] http://repo.mongodb.com/apt/ubuntu precise/mongodb-enterprise/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list
|
||||
- sudo apt-get update
|
||||
- sudo apt-get install -y mongodb-enterprise-server
|
||||
script: npm run lint && npm test
|
||||
after_success:
|
||||
- cat coverage/lcov.info | node_modules/.bin/coveralls
|
||||
notifications:
|
||||
email: false
|
||||
slack:
|
||||
secure: dZL3mHFwaqFP8JD19pe5iodurWVwSd3YuDBfMcwdypR59h1zhMM/A8MU5Yv6P5tArDCbvumewrSah9NghFEVJS5KbuGEWt+i33X8vDYMzxR9yhEuqNUKWCJSsQtkLuzdtNToeqfWf4ozRrTL8S3f7EVj7QXda/p7SF9iW7WKpogLwVK6evxHN7aUJTbyW02syRwzeqF9FGptxfulZbKTlRj0At7i48/+wtDGMLsOx887HsdWpVXds47wcEmL9VBYa6SoxqHV/pkPl2PS031lOyOST2Hjg+bfeQmhxTjdyzYi3uYXcqoEpLMim2iPknEUxmZPspzsctzegk3eJcP5jWKUT4tdx36KIAW6vJNBNG7ybG7oG9Dk9HrJswDyv28fShF8XYb2JYgtXdG1pp5kwGVtY67p00/Zwcr1l6kKzavQJKTsWjakA2mA+4Ix7kUHEVuHEIdFHrd32J1y4Z9P7OJHZ9HLrXzHh0rBcN5lRi4tSrw60hg5A6QlWxOeYRJEucB4C03yhU38eiSKwXAyJSMJ5hujGP7bVPjBkYZjxO5tLvINrO/1rMN9FE/DLHLY3mRK1nIGgFI/axOQ/oarLmdY7aFezE+GoiiRrD5vdYEIvy5ebemjHsWMlIsGQOHaI05a2S3O/zh3GCibZu1QBHiCjM/PSBhISOK6W26q7DQ=
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- develop
|
||||
62
VISUALIZACION/node_modules/mongod/CHANGELOG.md
generated
vendored
Executable file
62
VISUALIZACION/node_modules/mongod/CHANGELOG.md
generated
vendored
Executable file
|
|
@ -0,0 +1,62 @@
|
|||
# mongod
|
||||
|
||||
This project adheres to [Semantic Versioning](http://semver.org/). Notable
|
||||
changes to this project will be documented in this file for which the format
|
||||
is based on [Keep a Changelog](http://keepachangelog.com/).
|
||||
|
||||
### [2.0.0][] - 2017-01-17
|
||||
|
||||
#### Added
|
||||
|
||||
- Support for NPM install
|
||||
- Lint markdown with remark
|
||||
|
||||
### [1.0.0][] — 2017-01-16
|
||||
|
||||
#### Added
|
||||
|
||||
- Changelog
|
||||
|
||||
#### Fixed
|
||||
|
||||
- “stdout” event not emitted for stderr
|
||||
|
||||
---
|
||||
|
||||
### [0.2.0][] — 2017-01-08
|
||||
|
||||
#### Added
|
||||
|
||||
- Support for `--nojournal` (`Mongod~Config#nojournal`)
|
||||
|
||||
---
|
||||
|
||||
### [0.1.0][] — 2017-01-08
|
||||
|
||||
#### Added
|
||||
|
||||
- Support for `--storageEngine` (`Mongod~Config#storageEngine`)
|
||||
- “open” and “close” events
|
||||
|
||||
#### Changed
|
||||
|
||||
- Update dev dependencies
|
||||
- eslint 3.13.0
|
||||
|
||||
#### Fixed
|
||||
|
||||
- Errors when calling `#open()` or `#close()` repetitiously
|
||||
|
||||
---
|
||||
|
||||
### [0.0.1][] — 2016-12-24
|
||||
|
||||
#### Added
|
||||
|
||||
- Initial release
|
||||
|
||||
[2.0.0]: https://github.com/BrandonZacharie/node-mongod/compare/1.0.0...2.0.0
|
||||
[1.0.0]: https://github.com/BrandonZacharie/node-mongod/compare/0.2.0...1.0.0
|
||||
[0.2.0]: https://github.com/BrandonZacharie/node-mongod/compare/0.1.0...0.2.0
|
||||
[0.1.0]: https://github.com/BrandonZacharie/node-mongod/compare/0.0.1...0.1.0
|
||||
[0.0.1]: https://github.com/BrandonZacharie/node-mongod/compare/694e8...0.0.1
|
||||
8
VISUALIZACION/node_modules/mongod/LICENSE.md
generated
vendored
Executable file
8
VISUALIZACION/node_modules/mongod/LICENSE.md
generated
vendored
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
MIT License
|
||||
Copyright (c) 2016 Brandon Zacharie
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
447
VISUALIZACION/node_modules/mongod/Mongod.js
generated
vendored
Executable file
447
VISUALIZACION/node_modules/mongod/Mongod.js
generated
vendored
Executable file
|
|
@ -0,0 +1,447 @@
|
|||
'use strict';
|
||||
|
||||
/**
|
||||
* Configuration options for {@link Mongod}.
|
||||
* @typedef {Object} Mongod~Config
|
||||
* @property {String} [bin=mongod]
|
||||
* @property {String} [config]
|
||||
* @property {(Number|String)} [port=27017]
|
||||
* @property {String} [dbpath]
|
||||
* @property {String} [storageEngine]
|
||||
* @property {Boolean} [nojournal=false]
|
||||
*/
|
||||
|
||||
/**
|
||||
* Invoked when an operation (i.e. {@link Mongod#open}) completes.
|
||||
* @callback Mongod~callback
|
||||
* @argument {Error} err
|
||||
*/
|
||||
|
||||
const childprocess = require('child_process');
|
||||
const events = require('events');
|
||||
const PromiseQueue = require('promise-queue');
|
||||
|
||||
/**
|
||||
* A collection of regualar expressions used by {@link Mongod.parseData} to
|
||||
* parse stdout and stderr messages.
|
||||
* @see Mongod.parseData
|
||||
* @readonly
|
||||
* @private
|
||||
* @type {Object.<String,RegExp>}
|
||||
*/
|
||||
const regExp = {
|
||||
terminalMessage: /waiting\s+for\s+connections|already\s+in\s+use|denied|error|exception|badvalue/im,
|
||||
whiteSpace: /\s/g,
|
||||
newline: /\r?\n/
|
||||
};
|
||||
|
||||
/**
|
||||
* Start and stop a local MongoDB server like a boss.
|
||||
* @class
|
||||
*/
|
||||
class Mongod extends events.EventEmitter {
|
||||
|
||||
/**
|
||||
* Get a function that takes chunks of stdin data, aggregates it, and passes
|
||||
* it in complete lines, one by one, to a given {@link Mongod~callback}.
|
||||
* @argument {Mongod~callback} callback
|
||||
* @return {Function}
|
||||
*/
|
||||
static getTextLineAggregator(callback) {
|
||||
let buffer = '';
|
||||
|
||||
return (data) => {
|
||||
const fragments = data.toString().split(regExp.newline);
|
||||
const lines = fragments.slice(0, fragments.length - 1);
|
||||
|
||||
// If there was an unended line in the previous dump, complete it by
|
||||
// the first section.
|
||||
lines[0] = buffer + lines[0];
|
||||
|
||||
// If there is an unended line in this dump, store it to be completed by
|
||||
// the next. This assumes there will be a terminating newline character
|
||||
// at some point. Generally, this is a safe assumption.
|
||||
buffer = fragments[fragments.length - 1];
|
||||
|
||||
for (let line of lines) {
|
||||
callback(line);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate a given {@link Mongod~Config} with values from a
|
||||
* given {@link Mongod~Config}.
|
||||
* @protected
|
||||
* @argument {Mongod~Config} source
|
||||
* @argument {Mongod~Config} target
|
||||
* @return {Mongod~Config}
|
||||
*/
|
||||
static parseConfig(source, target) {
|
||||
if (target == null) {
|
||||
target = Object.create(null);
|
||||
}
|
||||
|
||||
if (source == null) {
|
||||
return target;
|
||||
}
|
||||
|
||||
if (typeof source === 'number' || typeof source === 'string') {
|
||||
target.port = source;
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
if (typeof source !== 'object') {
|
||||
return target;
|
||||
}
|
||||
|
||||
if (source.bin != null) {
|
||||
target.bin = source.bin;
|
||||
}
|
||||
|
||||
if (source.conf != null) {
|
||||
target.conf = source.conf;
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
if (source.nojournal === true) {
|
||||
target.nojournal = true;
|
||||
}
|
||||
|
||||
if (source.storageEngine != null) {
|
||||
target.storageEngine = source.storageEngine;
|
||||
}
|
||||
|
||||
if (source.dbpath != null) {
|
||||
target.dbpath = source.dbpath;
|
||||
}
|
||||
|
||||
if (source.port != null) {
|
||||
target.port = source.port;
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse process flags for MongoDB from a given {@link Mongod~Config}.
|
||||
* @protected
|
||||
* @argument {Mongod~Config} config
|
||||
* @return {Array.<String>}
|
||||
*/
|
||||
static parseFlags(config) {
|
||||
if (config.conf != null) {
|
||||
return ['--config', config.conf];
|
||||
}
|
||||
|
||||
const flags = [];
|
||||
|
||||
if (config.nojournal) {
|
||||
flags.push('--nojournal');
|
||||
}
|
||||
|
||||
if (config.storageEngine != null) {
|
||||
flags.push('--storageEngine', config.storageEngine);
|
||||
}
|
||||
|
||||
if (config.dbpath != null) {
|
||||
flags.push('--dbpath', config.dbpath);
|
||||
}
|
||||
|
||||
if (config.port != null) {
|
||||
flags.push('--port', config.port);
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse MongoDB server output for terminal messages.
|
||||
* @protected
|
||||
* @argument {String} string
|
||||
* @return {Object}
|
||||
*/
|
||||
static parseData(string) {
|
||||
const matches = regExp.terminalMessage.exec(string);
|
||||
|
||||
if (matches === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const result = {
|
||||
err: null,
|
||||
key: matches
|
||||
.pop()
|
||||
.replace(regExp.whiteSpace, '')
|
||||
.toLowerCase()
|
||||
};
|
||||
|
||||
switch (result.key) {
|
||||
case 'waitingforconnections':
|
||||
break;
|
||||
|
||||
case 'alreadyinuse':
|
||||
result.err = new Error('Address already in use');
|
||||
result.err.code = -1;
|
||||
|
||||
break;
|
||||
|
||||
case 'denied':
|
||||
result.err = new Error('Permission denied');
|
||||
result.err.code = -2;
|
||||
|
||||
break;
|
||||
|
||||
case 'error':
|
||||
case 'exception':
|
||||
case 'badvalue':
|
||||
result.err = new Error(string.trim());
|
||||
result.err.code = -3;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start a given {@link Mongod}.
|
||||
* @protected
|
||||
* @argument {Mongod} server
|
||||
* @return {Promise}
|
||||
*/
|
||||
static open(server) {
|
||||
if (server.isOpening) {
|
||||
return server.openPromise;
|
||||
}
|
||||
|
||||
server.isOpening = true;
|
||||
server.isClosing = false;
|
||||
server.openPromise = server.promiseQueue.add(() => {
|
||||
if (server.isClosing || server.isRunning) {
|
||||
server.isOpening = false;
|
||||
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
/**
|
||||
* A listener for the current server process' stdout/stderr that
|
||||
* resolves or rejects the current {@link Promise} when done.
|
||||
* @see Mongod.getTextLineAggregator
|
||||
* @see Mongod.parseData
|
||||
* @argument {Buffer} buffer
|
||||
* @return {undefined}
|
||||
*/
|
||||
const dataListener = Mongod.getTextLineAggregator((value) => {
|
||||
const result = Mongod.parseData(value);
|
||||
|
||||
if (result === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
server.process.stdout.removeListener('data', dataListener);
|
||||
|
||||
server.isOpening = false;
|
||||
|
||||
if (result.err === null) {
|
||||
server.isRunning = true;
|
||||
|
||||
server.emit('open');
|
||||
resolve(null);
|
||||
}
|
||||
else {
|
||||
server.isClosing = true;
|
||||
|
||||
server.emit('closing');
|
||||
server.process.once('close', () => reject(result.err));
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* A listener to close the server when the current process exits.
|
||||
* @return {undefined}
|
||||
*/
|
||||
const exitListener = () => {
|
||||
// istanbul ignore next
|
||||
server.close();
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a text line aggregator that emits a given {@linkcode event}
|
||||
* for the current server.
|
||||
* @see Mongod.getTextLineAggregator
|
||||
* @argument {String} event
|
||||
* @return {Function}
|
||||
*/
|
||||
const getDataPropagator = (event) =>
|
||||
Mongod.getTextLineAggregator((line) => server.emit(event, line));
|
||||
|
||||
server.emit('opening');
|
||||
|
||||
server.process = childprocess.spawn(
|
||||
server.config.bin,
|
||||
Mongod.parseFlags(server.config)
|
||||
);
|
||||
|
||||
server.process.stderr.on('data', dataListener);
|
||||
server.process.stderr.on('data', getDataPropagator('stdout'));
|
||||
server.process.stdout.on('data', dataListener);
|
||||
server.process.stdout.on('data', getDataPropagator('stdout'));
|
||||
server.process.on('close', () => {
|
||||
server.process = null;
|
||||
server.isRunning = false;
|
||||
server.isClosing = false;
|
||||
|
||||
process.removeListener('exit', exitListener);
|
||||
server.emit('close');
|
||||
});
|
||||
process.on('exit', exitListener);
|
||||
});
|
||||
});
|
||||
|
||||
return server.openPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop a given {@link Mongod}.
|
||||
* @protected
|
||||
* @argument {Mongod} server
|
||||
* @return {Promise}
|
||||
*/
|
||||
static close(server) {
|
||||
if (server.isClosing) {
|
||||
return server.closePromise;
|
||||
}
|
||||
|
||||
server.isClosing = true;
|
||||
server.isOpening = false;
|
||||
server.closePromise = server.promiseQueue.add(() => {
|
||||
if (server.isOpening || !server.isRunning) {
|
||||
server.isClosing = false;
|
||||
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
server.emit('closing');
|
||||
server.process.once('close', () => resolve(null));
|
||||
server.process.kill();
|
||||
});
|
||||
});
|
||||
|
||||
return server.closePromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new {@link Mongod}.
|
||||
* @argument {(Number|String|Mongod~Config)} [configOrPort]
|
||||
* A number or string that is a port or an object for configuration.
|
||||
*/
|
||||
constructor(configOrPort) {
|
||||
super();
|
||||
|
||||
/**
|
||||
* Configuration options.
|
||||
* @protected
|
||||
* @type {Mongod~Config}
|
||||
*/
|
||||
this.config = Mongod.parseConfig(configOrPort, {
|
||||
bin: 'mongod',
|
||||
conf: null,
|
||||
port: 27017,
|
||||
dbpath: null,
|
||||
storageEngine: null,
|
||||
nojournal: false
|
||||
});
|
||||
|
||||
/**
|
||||
* The current process.
|
||||
* @protected
|
||||
* @type {ChildProcess}
|
||||
*/
|
||||
this.process = null;
|
||||
|
||||
/**
|
||||
* The last {@link Promise} returned by {@link Mongod#open}.
|
||||
* @protected
|
||||
* @type {Promise}
|
||||
*/
|
||||
this.openPromise = Promise.resolve(null);
|
||||
|
||||
/**
|
||||
* The last {@link Promise} returned by {@link Mongod#close}.
|
||||
* @protected
|
||||
* @type {Promise}
|
||||
*/
|
||||
this.closePromise = Promise.resolve(null);
|
||||
|
||||
/**
|
||||
* A serial queue of open and close promises.
|
||||
* @protected
|
||||
* @type {PromiseQueue}
|
||||
*/
|
||||
this.promiseQueue = new PromiseQueue(1);
|
||||
|
||||
/**
|
||||
* Determine if the instance is closing a MongoDB server; {@linkcode true}
|
||||
* while a process is being, or about to be, killed until the
|
||||
* contained MongoDB server either closes or errs.
|
||||
* @readonly
|
||||
* @type {Boolean}
|
||||
*/
|
||||
this.isClosing = false;
|
||||
|
||||
/**
|
||||
* Determine if the instance is starting a MongoDB server; {@linkcode true}
|
||||
* while a process is spawning, or about tobe spawned, until the
|
||||
* contained MongoDB server either starts or errs.
|
||||
* @readonly
|
||||
* @type {Boolean}
|
||||
*/
|
||||
this.isRunning = false;
|
||||
|
||||
/**
|
||||
* Determine if the instance is running a MongoDB server; {@linkcode true}
|
||||
* once a process has spawned and the contained MongoDB server is ready
|
||||
* to service requests.
|
||||
* @readonly
|
||||
* @type {Boolean}
|
||||
*/
|
||||
this.isOpening = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the server.
|
||||
* @argument {Mongod~callback} [callback]
|
||||
* @return {Promise}
|
||||
*/
|
||||
open(callback) {
|
||||
const promise = Mongod.open(this);
|
||||
|
||||
return typeof callback === 'function'
|
||||
? promise
|
||||
.then((v) => callback(null, v))
|
||||
.catch((e) => callback(e, null))
|
||||
: promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the server.
|
||||
* @argument {Mongod~callback} [callback]
|
||||
* @return {Promise}
|
||||
*/
|
||||
close(callback) {
|
||||
const promise = Mongod.close(this);
|
||||
|
||||
return typeof callback === 'function'
|
||||
? promise
|
||||
.then((v) => callback(null, v))
|
||||
.catch((e) => callback(e, null))
|
||||
: promise;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = Mongod;
|
||||
176
VISUALIZACION/node_modules/mongod/README.md
generated
vendored
Executable file
176
VISUALIZACION/node_modules/mongod/README.md
generated
vendored
Executable file
|
|
@ -0,0 +1,176 @@
|
|||
# mongod
|
||||
|
||||
[](https://www.npmjs.com/package/mongod)
|
||||
[](https://travis-ci.org/BrandonZacharie/node-mongod)
|
||||
[](https://coveralls.io/github/BrandonZacharie/node-mongod?branch=master)
|
||||
[](https://github.com/BrandonZacharie/node-mongod/blob/master/LICENSE.md)
|
||||
|
||||
Start and stop a local MongoDB server in Node.js like a boss.
|
||||
|
||||
## Installation
|
||||
|
||||
```Bash
|
||||
|
||||
npm install mongod
|
||||
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
The constructor exported by this module optionally accepts a single argument;
|
||||
a number or string that is a port or an object for configuration.
|
||||
|
||||
### Basic Example
|
||||
|
||||
```JavaScript
|
||||
|
||||
const Mongod = require('mongod');
|
||||
|
||||
// Simply pass the port that you want a MongoDB server to listen on.
|
||||
const server = new Mongod(27017);
|
||||
|
||||
server.open((err) => {
|
||||
if (err === null) {
|
||||
// You may now connect a client to the MongoDB
|
||||
// server bound to port 27017.
|
||||
}
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
| Property | Type | Default | Description
|
||||
|:--------------|:--------|:--------|:-----------
|
||||
| bin | String | mongod | A path to a MongoDB server binary.
|
||||
| conf | String | | A path to a MongoDB server configuration file.
|
||||
| dbpath | String | | A path to a to store MongoDB server files.
|
||||
| storageEngine | String | | A MongoDB storage engine (i.e. wiredTiger).
|
||||
| nojournal | Boolean | false | A flag to tell MongoDB to disable journaling.
|
||||
| port | Number | 27017 | A port to bind a MongoDB server to.
|
||||
|
||||
A MongoDB server binary must be available. If you do not have one in $PATH,
|
||||
provide a path in configuration.
|
||||
|
||||
```JavaScript
|
||||
|
||||
const server = new Mongod({
|
||||
port: 27017,
|
||||
bin: '/opt/local/bin/mongod'
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
You may use a MongoDB configuration file instead of configuration object
|
||||
properties that are flags (i.e. `dbpath` and `port`). If `conf` is
|
||||
provided, no flags will be passed to the binary.
|
||||
|
||||
```JavaScript
|
||||
|
||||
const server = new Mongod({
|
||||
conf: '/path/to/mongodb.conf'
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
### Methods
|
||||
|
||||
For methods that accept `callback`, `callback` will receive an `Error`
|
||||
as the first argument if a problem is detected; `null`, if not.
|
||||
|
||||
#### Mongod#open()
|
||||
|
||||
Attempt to open a MongoDB server. Returns a `Promise`.
|
||||
|
||||
##### Promise style `open()`
|
||||
|
||||
``` JavaScript
|
||||
|
||||
server.open().then(() => {
|
||||
// You may now connect to the MongoDB server.
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
##### Callback style `open()`
|
||||
|
||||
``` JavaScript
|
||||
|
||||
server.open((err) => {
|
||||
if (err === null) {
|
||||
// You may now connect to the MongoDB server.
|
||||
}
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
#### Mongod#close()
|
||||
|
||||
Close the associated MongoDB server. Returns a `Promise`. NOTE: Disconnect
|
||||
clients prior to calling this method to avoid receiving connection
|
||||
errors from clients.
|
||||
|
||||
##### Promise style `close()`
|
||||
|
||||
``` JavaScript
|
||||
|
||||
server.close().then(() => {
|
||||
// The MongoDB server is now closed.
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
##### Callback style `close()`
|
||||
|
||||
``` JavaScript
|
||||
|
||||
server.close((err) => {
|
||||
// The MongoDB server is now closed.
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
#### Mongod#isOpening
|
||||
|
||||
Determine if the instance is starting a MongoDB server; `true` while a
|
||||
process is spawning, and/or about to be spawned, until the contained MongoDB
|
||||
server either starts or errs.
|
||||
|
||||
#### Mongod#isRunning
|
||||
|
||||
Determine if the instance is running a MongoDB server; `true` once a process
|
||||
has spawned and the contained MongoDB server is ready to service requests.
|
||||
|
||||
#### Mongod#isClosing
|
||||
|
||||
Determine if the instance is closing a MongoDB server; `true` while a
|
||||
process is being, or about to be, killed until the contained MongoDB server
|
||||
either closes or errs.
|
||||
|
||||
### Events
|
||||
|
||||
#### stdout
|
||||
|
||||
Emitted when a MongoDB server prints to stdout or stderr.
|
||||
|
||||
#### opening
|
||||
|
||||
Emitted when attempting to start a MongoDB server.
|
||||
|
||||
#### open
|
||||
|
||||
Emitted when a MongoDB server becomes ready to service requests.
|
||||
|
||||
#### closing
|
||||
|
||||
Emitted when attempting to stop a MongoDB server.
|
||||
|
||||
#### close
|
||||
|
||||
Emitted when a MongoDB server closes.
|
||||
|
||||
## Credits
|
||||
|
||||
A special thanks to @ForbesLindesay for contributing the NPM package name.
|
||||
45
VISUALIZACION/node_modules/mongod/package.json
generated
vendored
Executable file
45
VISUALIZACION/node_modules/mongod/package.json
generated
vendored
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "mongod",
|
||||
"description": "Start and stop a MongoDB server.",
|
||||
"keywords": [
|
||||
"mongodb",
|
||||
"server",
|
||||
"manager"
|
||||
],
|
||||
"version": "2.0.0",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/BrandonZacharie/node-mongod#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/BrandonZacharie/node-mongod/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/BrandonZacharie/node-mongod.git"
|
||||
},
|
||||
"author": {
|
||||
"name": "Brandon Zacharie",
|
||||
"email": "brandon.zacharie@gmail.com"
|
||||
},
|
||||
"main": "Mongod.js",
|
||||
"scripts": {
|
||||
"test": "istanbul cover -x test.js _mocha",
|
||||
"lint": "npm run eslint && npm run remark",
|
||||
"eslint": "eslint --ignore-path .gitignore **/*.js",
|
||||
"remark": "remark ."
|
||||
},
|
||||
"dependencies": {
|
||||
"promise-queue": "^2.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^3.5.0",
|
||||
"coveralls": "^2.11.15",
|
||||
"eslint": "^3.13.0",
|
||||
"fs-promise": "^1.0.0",
|
||||
"istanbul": "^0.4.5",
|
||||
"js-yaml": "^3.7.0",
|
||||
"mocha": "^3.1.2",
|
||||
"remark-cli": "^2.1.0",
|
||||
"remark-preset-lint-recommended": "^1.0.0",
|
||||
"uuid": "^3.0.1"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue