Skip to content

Commit

Permalink
fix(mongolib): delete direct connexion true
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihoub2 committed Oct 7, 2024
1 parent ca679c1 commit 6d6dd1d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion server/libs/mongo.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MongoClient } from "mongodb";

const mongoUri = process.env.MONGO_URI || "";
const client = new MongoClient(mongoUri, { directConnection: true });
const client = new MongoClient(mongoUri);
const db = client.db("ticket-office-api");

export default db;
4 changes: 0 additions & 4 deletions server/routes/receive-email/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,15 @@ async function updateContribution(
const database = client.db(dbName);
const collection = database.collection(collectionName);

// Assurez-vous que la collection existe avant de continuer
if (!collection) {
console.log("La collection n'existe pas :", collectionName);
return;
}

// Utilisez le bon champ de recherche
const contribution = await collection.findOne({
// Assurez-vous que 'id' est le bon champ à interroger
id: referenceId,
});

console.log(contribution);
if (contribution) {
const existingThreads = Array.isArray(contribution.threads)
? contribution.threads
Expand Down

0 comments on commit 6d6dd1d

Please sign in to comment.