Avoid id alias globally
See original GitHub issueDo you want to request a feature or report a bug?
bug
What is the current behavior?
In one of my plugins I’ve set id false
to avoid id in all my models, it worked on 5.13.x, but now it’s not working in 6.0.x
If the current behavior is a bug, please provide the steps to reproduce.
"use strict";
const mongoose = require("mongoose");
const {Schema, model} = mongoose;
const test = new Schema({
test: {
type: Number
}
});
const test2 = new Schema(
{
test: {
type: Number
}
},
{id: false}
);
mongoose.plugin((schema) => schema.set("id", false));
const Test = model("Test", test);
const newTest = new Test();
console.log(newTest.id);
const Test2 = model("Test2", test2);
const newTest2 = new Test2();
console.log(newTest2.id);
What is the expected behavior?
I’d like to be able to set id false
globally, instead of using a plugin. For the moment I need a solution to avoid id alias in my models as Schema.set("id", false);
is not working in a plugin.
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that “latest” is not a version.
Node 16.8.0
Mongoose 6.0.5
Mongodb atlas 4.4.8
Issue Analytics
- State:
- Created 2 years ago
- Comments:9
Top Results From Across the Web
Your AWS account ID and its alias
The account alias must be unique across all Amazon Web Services products. It must contain only digits, lowercase letters, and hyphens. For more...
Read more >Why does sudo ignore aliases? - Unix & Linux Stack Exchange
This creates a global alias called $ (you can use any word you want) which ends in a space. This causes zsh to...
Read more >How to best set up command aliases on Linux - Network World
Setting up the most useful aliases on Linux is a mix of what's otherwise annoying to enter, hard to remember or typed way...
Read more >The Fun of Doing Business Under an Alias or Assumed Name
People may use aliases to conceal their identity but for companies, there are several very legitimate reasons to use an alias or assumed...
Read more >Create and remove aliases on Mac - Apple Support
In the Finder on your Mac, create an alias to represent a file, folder, app, or disk. Put the alias in a convenient,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I took a closer look and you’re right, this is a bug. We tried to refactor
id
to be a plugin in #3936 for 6.0, made a note to undo that refactor, but didn’t get to it. Lessons learned: make a separate issue instead of treating the issue as “done” but relying on a comment as a mental note to self.We’ll ship 6.0.7 with this fix on Monday 👍
Hi @vkarpov15 Just like any other sort system, FIFO…