- Aggiornato i vari .ENV
This commit is contained in:
@@ -36,6 +36,8 @@ module.exports = {
|
||||
try {
|
||||
if (!attiva && await table.countDocuments({}) > 0) return;
|
||||
|
||||
let primavolta = false;
|
||||
|
||||
const pathfile = Path.join(__dirname, tablename + '.js');
|
||||
if (tools.isFileExists(pathfile)) {
|
||||
const mydbfile = require(pathfile);
|
||||
@@ -57,10 +59,15 @@ module.exports = {
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
const existingDoc = await table.findOne(query);
|
||||
if (!existingDoc) {
|
||||
if (!primavolta) {
|
||||
console.log('Tabella: ', tablename);
|
||||
primavolta = true;
|
||||
}
|
||||
|
||||
console.log('ADD: ' + query);
|
||||
console.log('ADDING: ', query);
|
||||
|
||||
const { value: existingDoc, upserted } = await table.findOneAndUpdate(
|
||||
query,
|
||||
@@ -72,6 +79,8 @@ module.exports = {
|
||||
// Il documento non esisteva, è stato creato
|
||||
console.log('Inserted document with _id:', existingDoc._id);
|
||||
numrec++;
|
||||
} else {
|
||||
console.log(' ... Non inserito !')
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user