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

Reopen: Configuration to disable inclusion of embedded document schema index definitions #5575 #8343

Closed
armaserg opened this issue Nov 15, 2019 · 2 comments
Labels
docs This issue is due to a mistake or omission in the mongoosejs.com documentation enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Milestone

Comments

@armaserg
Copy link

This topic was discussed here: #5575
It looks like the problem was fixed in mongosee 4.13

But, does it work now?
There is no documentation about this: https://mongoosejs.com/docs/search.html?q=excludeIndexes :(

I have such schemas:

const TechnologySchema: Schema = new Schema({
  name: {type: String, unique: true, excludeIndexes: true}
}, {excludeIndexes: true});

const ProjectSchema: Schema = new mongoose.Schema({
  name: String,
  technologies: [TechnologySchema],
}, {excludeIndexes: true});

But in 'projects' collection I still have 'technologies.name' unique index :(

How can I prevent this?
thanks!

@vkarpov15 vkarpov15 added this to the 5.7.12 milestone Nov 16, 2019
@vkarpov15 vkarpov15 added the needs repro script Maybe a bug, but no repro script. The issue reporter should create a script that demos the issue label Nov 16, 2019
@vkarpov15
Copy link
Collaborator

We need some docs and improvements for this option, but here's how you make it work:

const ProjectSchema = new mongoose.Schema({
  name: String,
  technologies: { type: [TechnologySchema], excludeIndexes: true },
});

@vkarpov15 vkarpov15 added confirmed-bug We've confirmed this is a bug in Mongoose and will fix it. enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature docs This issue is due to a mistake or omission in the mongoosejs.com documentation and removed needs repro script Maybe a bug, but no repro script. The issue reporter should create a script that demos the issue confirmed-bug We've confirmed this is a bug in Mongoose and will fix it. labels Nov 18, 2019
vkarpov15 added a commit that referenced this issue Nov 18, 2019
@victors1681
Copy link

@vkarpov15 man you deserve a beer! this excludeIndexes is very important option, when we are reusing Schema as a nested one. Definitely the doc need to improve that feature.

@Automattic Automattic locked as resolved and limited conversation to collaborators Dec 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
docs This issue is due to a mistake or omission in the mongoosejs.com documentation enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Projects
None yet
Development

No branches or pull requests

3 participants