Skip to content
New issue

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

Avoid sending null session option with document ops #13052

Closed
2 tasks done
vkarpov15 opened this issue Feb 19, 2023 · 0 comments · Fixed by #13053
Closed
2 tasks done

Avoid sending null session option with document ops #13052

vkarpov15 opened this issue Feb 19, 2023 · 0 comments · Fixed by #13053
Milestone

Comments

@vkarpov15
Copy link
Collaborator

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Mongoose version

6.9.x

Node.js version

16.x

MongoDB server version

Any

Typescript version (if applicable)

No response

Description

'use strict';

const mongoose = require('mongoose');
mongoose.set('debug', true);

run().catch(err => console.log(err));

async function run() {
  await mongoose.connect('mongodb://localhost:27017/test');
  const schema = new mongoose.Schema({ name: String });
  const Test = mongoose.model('Test', schema);

  // Mongoose: tests.insertOne({ name: 'foo', _id: new ObjectId("63f28c9760c00f9e5b3d6001"), __v: 0 }, { session: null })
  await Test.create({ name: 'foo' });
}

Sending a null session is unnecessary and confusing. session shouldn't show up in debug output if you're not using sessions.

Steps to Reproduce

See description

Expected Behavior

No response

@vkarpov15 vkarpov15 added this to the 6.9.3 milestone Feb 19, 2023
vkarpov15 added a commit that referenced this issue Feb 20, 2023
fix(model): avoid sending null session option with document operations
vkarpov15 added a commit that referenced this issue Mar 7, 2023
test(query): refactored test case for empty session property
vkarpov15 added a commit that referenced this issue Apr 3, 2023
IslandRhythms added a commit that referenced this issue May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant