Comparing version 1.0.8 to 1.0.9
@@ -20,2 +20,12 @@ ## [Unreleased] | ||
## [1.0.9] - 2018-08-22 | ||
### Added | ||
- dropCollection() method: remove a entire collection from a specific tenant. | ||
### Removed | ||
- timestamp "updatedAt" on insert actions | ||
## [1.0.8] - 2018-08-12 | ||
@@ -553,2 +563,3 @@ | ||
[1.0.9]: https://github.com/Yonirt/moltyjs/compare/v1.0.8...v1.0.9 | ||
[1.0.8]: https://github.com/Yonirt/moltyjs/compare/v1.0.7...v1.0.8 | ||
@@ -555,0 +566,0 @@ [1.0.7]: https://github.com/Yonirt/moltyjs/compare/v1.0.6...v1.0.7 |
@@ -186,3 +186,2 @@ 'use strict'; | ||
obj._data['createdAt'] = new Date(); | ||
obj._data['updatedAt'] = new Date(); | ||
} | ||
@@ -1240,4 +1239,51 @@ | ||
} | ||
/** | ||
* dropCollection(): Drop a collection, removing it permanently from the server. | ||
* | ||
* @param {String} tenant | ||
* @param {String} collection | ||
* @param [{String}] fields | ||
* | ||
* @returns {Promise} | ||
*/ | ||
dropCollection(collection, tenant) { | ||
var _this10 = this; | ||
return _asyncToGenerator(function* () { | ||
if (!tenant && typeof tenant != 'string') throw new Error('Should specify the tenant name (String), got: ' + tenant); | ||
// Acquiring db instance | ||
const conn = yield _this10._connectionManager.acquire(); | ||
return new Promise((() => { | ||
var _ref28 = _asyncToGenerator(function* (resolve, reject) { | ||
try { | ||
var _ref29 = yield to(conn.db(tenant, _this10._tenantsOptions).dropCollection(collection)), | ||
_ref30 = _slicedToArray(_ref29, 2); | ||
const error = _ref30[0], | ||
result = _ref30[1]; | ||
if (error) { | ||
reject(error); | ||
} else { | ||
resolve(result); | ||
} | ||
} catch (error) { | ||
reject(error); | ||
} finally { | ||
return yield _this10._connectionManager.release(conn); | ||
} | ||
}); | ||
return function (_x19, _x20) { | ||
return _ref28.apply(this, arguments); | ||
}; | ||
})()); | ||
})(); | ||
} | ||
} | ||
module.exports = new MongoClient(); |
{ | ||
"name": "moltyjs", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "A tiny ODM for MongoDB with multy tenancy support.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
133361
2427