Giter Site home page Giter Site logo

Comments (6)

mp911de avatar mp911de commented on June 20, 2024

That is likely and blocking the application can also happen on application startup if the MongoDB server isn't available. We generally recommend not using auto-index creation because of operational aspects like these and therefore, the feature is deprecated.

from spring-data-mongodb.

yxyeip avatar yxyeip commented on June 20, 2024

Hi @mp911de thanks for your reply, do you have any suggestions for replacement if not use auto index feature?

from spring-data-mongodb.

mp911de avatar mp911de commented on June 20, 2024

Please either use programmatic index creation or create indexes out of band by running scripts against MongoDB via e.g. the shell.

from spring-data-mongodb.

yxyeip avatar yxyeip commented on June 20, 2024

Programmatic index creation also need spring data mongodb add support to override commitQuorum option.
Currently, looks like there is no way to override it:

template.indexOps(Person.class)
.ensureIndex(new Index().on("age", Order.DESCENDING).unique()); // we need ensureIndex function has ability to pass CreateIndexOptions obj, then we can override commitQuorum on CreateIndexOptions obj

from spring-data-mongodb.

mp911de avatar mp911de commented on June 20, 2024

We use MongoCollection.createIndex to run the command. Only the createIndexes(…) command provides access to CreateIndexOptions exposing CreateIndexCommitQuorum and maxTimeMS options.

These aren't typically the options Spring Data is working with.

from spring-data-mongodb.

yxyeip avatar yxyeip commented on June 20, 2024

DefaultIndexOperations.ensureIndex called createIndexes(keys, indexOptions), my suggestions is provide other method DefaultIndexOperations.ensureIndex will call createIndexes(indexs, createIndexOptions)

from spring-data-mongodb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.