Avatar ·

Mongoose में TypeScript के साथ "current URL string parser is deprecated" चेतावनी को कैसे हटाएं

सभी को नमस्ते! मैं Express और TypeScript के साथ बैकएंड लिख रहा हूँ और MongoDB को Mongoose के माध्यम से उपयोग कर रहा हूँ। डेटाबेस से कनेक्ट करते समय मुझे कंसोल में यह चेतावनी मिल रही है:\n\n```\n(node:12345) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.\n```\n\nमैंने पहले ही options में `useNewUrlParser: true` जोड़ने की कोशिश की है, लेकिन फिर भी यह संदेश दिखाई देता है। यहाँ मेरा कोड है:\n\n```typescript\nimport mongoose from 'mongoose';\nimport { config } from './config';\n\nconst connectDB = async (): Promise => {\n try {\n await mongoose.connect(config.mongoURI, {\n useNewUrlParser: true,\n useUnifiedTopology: true,\n });\n console.log('MongoDB connected successfully');\n }\n