We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do you want to request a feature or report a bug? Bug
What is the current behavior? Calling replaceOne() with orFail() does not throw an exception.
replaceOne()
orFail()
If the current behavior is a bug, please provide the steps to reproduce.
const SharkSchema = new mongoose.Schema({ weight: Number, length: Number, }) const Shark = mongoose.model('Shark', SharkSchema) const result = await Shark .replaceOne({ weight: 1 }, { weight: 2, length: 3 }) .orFail() .catch(e => e) console.log(result) /*{ acknowledged: true, modifiedCount: 0, upsertedId: null, upsertedCount: 0, matchedCount: 0 } */
What is the expected behavior? An error should be thrown if the no document was found.
What are the versions of Node.js, Mongoose and MongoDB you are using? NodeJS: 16.13.0 Mongoose: 6.0.12 MongoDB: 4.4.10
The text was updated successfully, but these errors were encountered:
const mongoose = require('mongoose'); const SharkSchema = new mongoose.Schema({ weight: Number, length: Number, }) const Shark = mongoose.model('Shark', SharkSchema) async function run() { await mongoose.connect('mongodb://localhost:27017/', {useNewUrlParser: true, useUnifiedTopology: true,}); await mongoose.connection.dropDatabase(); const result = await Shark .replaceOne({ weight: 1 }, { weight: 2, length: 3 }) .orFail() .catch(e => e) console.log(result) } run();
Sorry, something went wrong.
97434b8
No branches or pull requests
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Calling
replaceOne()
withorFail()
does not throw an exception.If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
An error should be thrown if the no document was found.
What are the versions of Node.js, Mongoose and MongoDB you are using?
NodeJS: 16.13.0
Mongoose: 6.0.12
MongoDB: 4.4.10
The text was updated successfully, but these errors were encountered: