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

Robo3T1.3.1 can not create index #1692

Open
DancyLon opened this issue Nov 27, 2019 · 4 comments
Open

Robo3T1.3.1 can not create index #1692

DancyLon opened this issue Nov 27, 2019 · 4 comments
Projects

Comments

@DancyLon
Copy link

DancyLon commented Nov 27, 2019

My mongodb is v4.2.0,
when use the UI function to create indexes,it doesn't work.
I must use the shell command
>db.collection.createIndex(keys, options)
to create a index.
But when I use the UI function "Add Index" to edit my index,it is removed!!!!

@rx2347
Copy link

rx2347 commented Mar 10, 2020

I just ran into that too and spent some time until I figured it out, so I thought I'd share my findings, just in case someone wants to check out why it does not work at all right now and implement index creation for 4.2:

1. Unique Indexes
Support for dropDups on createIndex for unique indexes was removed in MongoDB 3.0
Source: https://docs.mongodb.com/manual/release-notes/3.0-compatibility/#remove-dropdups-option

If you already have duplicates in your collection and try to create a unique index, the index will not be created. This is expected behavior: See https://docs.mongodb.com/manual/core/index-unique/index.html (Behavior)
Robo3T should output this as an error.

So as I understand it, you have to remove duplicates by yourself now before creating a unique index.

And while we are at it:
2. Create in in Background
Deprecated in MongoDB 4.2 - You don't need it anymore as MongoDB now determines by itself how to best create indexes. https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/

As @DancyLon stated, right now Robo3T doesn't create any indexes on MongoDB 4.2, in fact it removes already created indexes when you try to edit them. As this can be quite harmful to the overall performance of your db, this should be fixed (or index creation removed alltogether) urgently. Until then: be aware.

@simsekgokhan
Copy link
Collaborator

simsekgokhan commented Jun 5, 2020

@DancyLon , @rx2347 , thanks a lot for your inputs and sorry for this inconvenience. Robo 1.3 does not support Mongodb 4.2. (https://github.com/Studio3T/robomongo#supported-platforms)

Also, another problem here, which is probably the root cause of your dropped index problems, is that MongoDB does not have "edit index" feature.
From MongoDB docs:

To modify an existing index, you need to drop and recreate the index.
Source: https://docs.mongodb.com/manual/tutorial/manage-indexes/#modify-an-index

It means that if the "create index" fails, you end up with a dropped index. It might be possible for Robo to try to re-create the old "dropped" index if create index fails. We will consider this option.

We have already started to work on this issue, seems that we have already found the core problems. The fix is planned to be included in new Robo version 1.4.

Mongodb 4.2 is also planned to be supported in new Robo version 1.4. Hope to release in 1-2 months.

@simsekgokhan
Copy link
Collaborator

simsekgokhan commented Sep 4, 2020

Hi all, we have some fixes related to this problem.
I hope Robo 3T 1.4 will fix it -> Robo 3T 1.4
Please let us know.

@lannyfrank
Copy link

lannyfrank commented Nov 13, 2020

It works fine, now: Robo 3T 1.4.1 (Build 122dbd9) and MongoDB 4.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

4 participants