c2-mongoose 2.1.191 → 2.1.193

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -128,7 +128,7 @@ var C2Flow = /** @class */ (function () {
128
128
  var dataAfter, log;
129
129
  return __generator(this, function (_a) {
130
130
  switch (_a.label) {
131
- case 0: return [4 /*yield*/, this.repository.findOneAndUpdate(searcher.filters, data, { session: options.session })];
131
+ case 0: return [4 /*yield*/, this.repository.findOneAndUpdate(searcher.filters, data, { returnDocument: 'after', session: options.session })];
132
132
  case 1:
133
133
  dataAfter = _a.sent();
134
134
  if (options.logger === false) {
@@ -62,6 +62,7 @@ var LoggerModel = new mongoose_1.Schema({
62
62
  timestamps: { createdAt: 'createdAtDateTime', updatedAt: 'updatedAtDateTime' }
63
63
  });
64
64
  exports.LoggerModel = LoggerModel;
65
+ LoggerModel.index({ "data._id": 1 }, { unique: false });
65
66
  var LoggerSearch = /** @class */ (function (_super) {
66
67
  __extends(LoggerSearch, _super);
67
68
  function LoggerSearch(params) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.191",
3
+ "version": "2.1.193",
4
4
  "description": "Lib to make any search in database mongoose and use as basic crud",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -59,7 +59,7 @@ class C2Flow<D> {
59
59
  }
60
60
 
61
61
  async updateByModel(searcher: SearchFlow, data: Partial<D>, options: Partial<Options>): Promise<Partial<D>> {
62
- let dataAfter = await this.repository.findOneAndUpdate(searcher.filters, data, { session: options.session })
62
+ let dataAfter = await this.repository.findOneAndUpdate(searcher.filters, data, { returnDocument: 'after', session: options.session })
63
63
 
64
64
  if (options.logger === false) {
65
65
  if (isEmpty(dataAfter)) {
@@ -28,6 +28,8 @@ const LoggerModel = new Schema({
28
28
  timestamps: { createdAt: 'createdAtDateTime', updatedAt: 'updatedAtDateTime' }
29
29
  })
30
30
 
31
+ LoggerModel.index({ "data._id": 1 }, { unique: false })
32
+
31
33
  class LoggerSearch extends SearchFlow {
32
34
  model: Partial<ILogger>
33
35
  constructor(params: any) {