Hello,
we startet useing sonarcloud to get some analysis of our NodeJS, typescript code. There are a lot of Code Smells regarding:
“await” should only be used with promises
There is also a question on Stackoverflow regarding this issue:
Mongoose promise and sonarqube
Example Code line:
noti = await notificatinModel.findOne({ '_id': new ObjectId(body.id_noti) }).lean();
Configuration of Mongoose:
import mongoose from "mongoose";
mongoose.Promise = Promise;
export default async () => {
await mongoose.connect(config.get('mongo.connectionString'), { useUnifiedTopology: true, useNewUrlParser: true });
}