@mongez/monpulse
Advanced tools
Comparing version 1.0.12 to 1.0.13
@@ -312,3 +312,3 @@ "use strict"; | ||
if (supportiveIs.isScalar(value)) { | ||
value = new RegExp(value, "i"); | ||
value = new RegExp(value, "gi"); | ||
} | ||
@@ -327,3 +327,3 @@ return wrapExpressionWithColumn( | ||
if (supportiveIs.isScalar(value)) { | ||
value = new RegExp(value, "i"); | ||
value = new RegExp(value, "gi"); | ||
} | ||
@@ -330,0 +330,0 @@ return wrapExpressionWithColumn( |
@@ -129,2 +129,6 @@ import { GenericObject } from "@mongez/reinforcements"; | ||
}; | ||
/** | ||
* Dump the entire collection | ||
*/ | ||
dump(): Promise<any>; | ||
} | ||
@@ -131,0 +135,0 @@ /** |
@@ -249,2 +249,8 @@ "use strict"; | ||
} | ||
/** | ||
* Dump the entire collection | ||
*/ | ||
async dump() { | ||
return await this.collection().find({}).toArray(); | ||
} | ||
} | ||
@@ -251,0 +257,0 @@ /** |
@@ -388,14 +388,17 @@ "use strict"; | ||
error instanceof mongodb.MongoServerError && | ||
error.code === 11000 && | ||
tries < 2 | ||
error.code === 11000 | ||
) { | ||
const duplicateField = error.keyValue; | ||
const fieldName = Object.keys(duplicateField)[0]; | ||
const errorMessage = `A record with the same ${fieldName} already exists.`; | ||
if (this.autoGeneratedId) { | ||
this.unset("id"); | ||
if (tries < 2) { | ||
const duplicateField = error.keyValue; | ||
const fieldName = Object.keys(duplicateField)[0]; | ||
const errorMessage = `A record with the same ${fieldName} already exists.`; | ||
if (this.autoGeneratedId) { | ||
this.unset("id"); | ||
} | ||
throw new Error(errorMessage); | ||
} else { | ||
tries--; | ||
} | ||
throw new Error(errorMessage); | ||
} | ||
tries--; | ||
throw error; | ||
} | ||
@@ -402,0 +405,0 @@ } |
@@ -310,3 +310,3 @@ import { ltrim } from "@mongez/reinforcements"; | ||
if (isScalar(value)) { | ||
value = new RegExp(value, "i"); | ||
value = new RegExp(value, "gi"); | ||
} | ||
@@ -325,3 +325,3 @@ return wrapExpressionWithColumn( | ||
if (isScalar(value)) { | ||
value = new RegExp(value, "i"); | ||
value = new RegExp(value, "gi"); | ||
} | ||
@@ -328,0 +328,0 @@ return wrapExpressionWithColumn( |
@@ -129,2 +129,6 @@ import { GenericObject } from "@mongez/reinforcements"; | ||
}; | ||
/** | ||
* Dump the entire collection | ||
*/ | ||
dump(): Promise<any>; | ||
} | ||
@@ -131,0 +135,0 @@ /** |
@@ -247,2 +247,8 @@ import { ObjectId } from "mongodb"; | ||
} | ||
/** | ||
* Dump the entire collection | ||
*/ | ||
async dump() { | ||
return await this.collection().find({}).toArray(); | ||
} | ||
} | ||
@@ -249,0 +255,0 @@ /** |
@@ -388,16 +388,16 @@ import { | ||
// Handle duplicate key error | ||
if ( | ||
error instanceof MongoServerError && | ||
error.code === 11000 && | ||
tries < 2 | ||
) { | ||
const duplicateField = error.keyValue; | ||
const fieldName = Object.keys(duplicateField)[0]; | ||
const errorMessage = `A record with the same ${fieldName} already exists.`; | ||
if (this.autoGeneratedId) { | ||
this.unset("id"); | ||
if (error instanceof MongoServerError && error.code === 11000) { | ||
if (tries < 2) { | ||
const duplicateField = error.keyValue; | ||
const fieldName = Object.keys(duplicateField)[0]; | ||
const errorMessage = `A record with the same ${fieldName} already exists.`; | ||
if (this.autoGeneratedId) { | ||
this.unset("id"); | ||
} | ||
throw new Error(errorMessage); | ||
} else { | ||
tries--; | ||
} | ||
throw new Error(errorMessage); | ||
} | ||
tries--; | ||
throw error; | ||
} | ||
@@ -404,0 +404,0 @@ } |
{ | ||
"name": "@mongez/monpulse", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "Powerful Mongodb Database Manager for Node Js", | ||
@@ -5,0 +5,0 @@ "main": "./cjs/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
467437
17773