Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Change Log

## [Unreleased]
### Added
- Apimap - Send engine name, engine version, framework name, framework version, database version and orm name in apimap meta.

## RELEASE 3.0.0-beta.0 - 2019-01-28
### Added
Expand Down
29 changes: 22 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,37 @@ exports.init = function(opts) {
opts.connections = [opts.mongoose];
}

exports.getLianaName = function () {
exports.getLianaName = function getLianaName() {
return 'forest-express-mongoose';
};

exports.getLianaVersion = function () {
exports.getLianaVersion = function getLianaVersion() {
var lianaVersion = require('./package.json').version.match(REGEX_VERSION);
if (lianaVersion && lianaVersion[0]) {
return lianaVersion[0];
}
};

exports.getOrmVersion = function () {
exports.getDatabaseType = function getDatabaseType() {
return 'MongoDB';
};

exports.getDatabaseVersion = function getDatabaseVersion() {
if (!opts.mongoose) { return null; }

opts.mongoose.db.command({ buildInfo: 1 }, function (error, info) {
if (error || !info) {
return null;
}
return info.version || null;
});
};

exports.getOrmName = function getOrmName() {
return 'mongoose';
};

exports.getOrmVersion = function getOrmVersion() {
if (!opts.mongoose) { return null; }

try {
Expand All @@ -42,10 +61,6 @@ exports.init = function(opts) {
}
};

exports.getDatabaseType = function () {
return 'MongoDB';
};

exports.SchemaAdapter = require('./adapters/mongoose');

exports.getModels = function () {
Expand Down