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
7.x.x
18.x
5
mongoose/lib/drivers/node-mongodb-native/collection.js
Line 212 in aaacf46
Clone array with args.slice(0, args.length)
args.slice(0, args.length)
session
import { connect } from 'mongoose'; import * as util from 'util'; (async () => { const MONGO_CONNECTION_STRING = 'mongodb://localhost:27017/db?&directConnection=true'; const mongoose = await connect(MONGO_CONNECTION_STRING); mongoose.set('debug', (collectionName, methodName, ...methodArgs) => { console.log(`${collectionName}.${methodName}(${util.inspect(methodArgs).slice(2, -2)})`); }); const collection = mongoose.connection.collection('Test'); await collection.findOne({ key: 'value' }); await mongoose.connection.close(); })();
Expect: print Test.findOne({ key: 'value' }) Actual: print Test.findOne()
Test.findOne({ key: 'value' })
Test.findOne()
The text was updated successfully, but these errors were encountered:
Merge pull request #13418 from Automattic/IslandRhythms/gh-13364
722ab43
fix: custom debug function not processing all args
I also see this happening in mongoose 6.8.0 - I'll submit a PR to backport the fix before the August eol date 😄
Sorry, something went wrong.
Merge pull request #13637 from Automattic/IslandRhythms/gh-13364-back…
0d17ccb
…port backported gh-13364
Successfully merging a pull request may close this issue.
Prerequisites
Mongoose version
7.x.x
Node.js version
18.x
MongoDB server version
5
Typescript version (if applicable)
5
Description
Issue
mongoose/lib/drivers/node-mongodb-native/collection.js
Line 212 in aaacf46
Logging with custom log function missing last argument due to incorrect slicing index.
Potential fix
Clone array with
args.slice(0, args.length)
Risk
session
which happen to be in last argumentSteps to Reproduce
Expected Behavior
Expect: print
Test.findOne({ key: 'value' })
Actual: print
Test.findOne()
The text was updated successfully, but these errors were encountered: