diff --git a/lib/swagger/gen.js b/lib/swagger/gen.js
index <HASH>..<HASH> 100644
--- a/lib/swagger/gen.js
+++ b/lib/swagger/gen.js
@@ -179,14 +179,16 @@ var swaggerModule = {
 				
 				//check if the dbs list contains a mongo or es model
 				var mongo = false, es = false;
-				context.soajs.config.dbs.forEach(function (oneDB) {
-					if (oneDB.mongo) {
-						mongo = true;
-					}
-					if (oneDB.es) {
-						es = true;
-					}
-				});
+				if(context.soajs.config.dbs && Array.isArray(context.soajs.config.dbs) && context.soajs.config.dbs.length > 0){
+					context.soajs.config.dbs.forEach(function (oneDB) {
+						if (oneDB.mongo) {
+							mongo = true;
+						}
+						if (oneDB.es) {
+							es = true;
+						}
+					});
+				}
 				
 				//if it does, then add the sample models
 				if (mongo) {
dbs and models is now optional.