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

Define IndexOptions in terms of mongodb.IndexOptions #10563

Merged
merged 1 commit into from
Aug 11, 2021

Conversation

JaredReisinger
Copy link
Contributor

Summary

The current IndexOptions definition is missing some mongo-allowed properties, like partialFilterExpression. Since mongoose simply passes the value along (after handling the added expires property), the type should be defined in the same way: as a simple extension to the mongo IndexOptions type.

Examples

This allows the following to work properly (in Typescript)

import mongoose from "mongoose";

export const schema = new mongoose.Schema({ whatever: String, useWhatever: Boolean });

schema.index({ whatever: 1 }, { partialFilterExpression: { useWhatever: true } });

The current mongoose.IndexOptions is missing some mongo-valid paroperties, like `partialFilterExpression`.
Copy link
Collaborator

@vkarpov15 vkarpov15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks 👍

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 this pull request may close these issues.

None yet

2 participants