@@ -18,18 +18,58 @@ exports.init = function(opts) {
1818 opts . connections = [ opts . mongoose ] ;
1919 }
2020
21- exports . getLianaName = function ( ) {
21+ exports . getLianaName = function getLianaName ( ) {
2222 return 'forest-express-mongoose' ;
2323 } ;
2424
25- exports . getLianaVersion = function ( ) {
25+ exports . getLianaVersion = function getLianaVersion ( ) {
2626 var lianaVersion = require ( './package.json' ) . version . match ( REGEX_VERSION ) ;
2727 if ( lianaVersion && lianaVersion [ 0 ] ) {
2828 return lianaVersion [ 0 ] ;
2929 }
3030 } ;
3131
32- exports . getOrmVersion = function ( ) {
32+ exports . getFrameworkName = function getFrameworkName ( ) {
33+ if ( ! opts . framework ) { return null ; }
34+ return opts . framework . name || null ;
35+ } ;
36+
37+ exports . getFrameworkVersion = function getFrameworkVersion ( ) {
38+ if ( ! opts . framework ) { return null ; }
39+
40+ try {
41+ var frameworkVersion = opts . framework . version . match ( REGEX_VERSION ) ;
42+ if ( frameworkVersion && frameworkVersion [ 0 ] ) {
43+ return frameworkVersion [ 0 ] ;
44+ }
45+ } catch ( error ) {
46+ return null ;
47+ }
48+ } ;
49+
50+ exports . getDatabaseName = function getDatabaseName ( ) {
51+ return 'MongoDB' ;
52+ } ;
53+
54+ // NOTICE: Deprecated
55+ exports . getDatabaseType = exports . getDatabaseName ;
56+
57+ exports . getDatabaseVersion = function getDatabaseVersion ( ) {
58+ if ( ! opts . mongoose ) { return null ; }
59+
60+ opts . mongoose . db . command ( { buildInfo : 1 } , function ( error , info ) {
61+ if ( error || ! info ) {
62+ return null ;
63+ }
64+ return info . version || null ;
65+ } ) ;
66+ } ;
67+
68+ exports . getOrmName = function getOrmName ( ) {
69+ return 'mongoose' ;
70+ } ;
71+
72+ exports . getOrmVersion = function getOrmVersion ( ) {
3373 if ( ! opts . mongoose ) { return null ; }
3474
3575 try {
@@ -42,10 +82,6 @@ exports.init = function(opts) {
4282 }
4383 } ;
4484
45- exports . getDatabaseType = function ( ) {
46- return 'MongoDB' ;
47- } ;
48-
4985 exports . SchemaAdapter = require ( './adapters/mongoose' ) ;
5086
5187 exports . getModels = function ( ) {
0 commit comments