Answer the question
In order to leave comments, you need to log in
How to find out the correct value of BD.findOne in mongoDB?
there is a function having connection to mongoDB:
const Breed = require('./models/Breed')
...
const addBreed = async (arr, data) => {
const title = arr[4]
let writeResult = null
const isАdded = await Breed.findOne({title})
console.log(isАdded)
if (isАdded) writeResult = isАdded._id
else {
const breed = new Breed({title})
writeResult = await breed.save()
}
addDog(arr, data, writeResult._id)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question