mongodb-haskell / mongodb

MongoDB driver for Haskell
http://hackage.haskell.org/package/mongoDB
Apache License 2.0
170 stars 44 forks source link

Show that index creation is broken badly #111

Closed TomMD closed 1 year ago

TomMD commented 4 years ago

This PR adds a test that shows the index creation is currently broken.

TomMD commented 4 years ago

N.B. https://docs.mongodb.com/manual/reference/system-collections/

Starting in MongoDB 4.2, .system.indexes has been removed (access to the collection has been deprecated since 3.0). To list the inndexes, use the listIndexes command instead.

Other communities have had issues too, such as dart-mongodb.

Interestingly, even as far back as 3.6 this test still fails but for other reasons. In MongoDB 3.6 the test successfully creates the index but getIndex fails to reflect that change (index creation confirmed using mongo shell).

A quick wireshark of the mongoshell reveals it is using OP_MSG though despite staring at it I can't make heads or tails of the body section that appears to be included which causes creation of the index. Hopefully someone who works this project is already familiar.

TomMD commented 4 years ago

PING! Is this project active? It seems the Haskell community has only Mongo (via this library) and cassandra available to it as NOSQL options.

VictorDenisov commented 4 years ago

The project is maintained. If you have a fix I'll be happy to merge it.

TomMD commented 4 years ago

Thanks @VictorDenisov - confirmation is good to hear. I'm using this library and feel there are multiple needs piling up that I'd like to deconflict with you and any plans you might already have. Before spewing all that out I'll note this PR was just to be up front about the status of things and was hoping it could merge regardless of a fix - more of a truth in advertising.

Thoughts for improving MongoDB + Haskell in 2020:

  1. It seems the library was built assuming network security was sufficient. This is not the case for some users, so brining the TLS support up to snuff and making it the default (even if that merely assumes the host's certificate chain) would be a huge step forward.
  2. The index creation is great in that it follows conventions already set forth by the rest of the library, but no longer functioning as this PR demonstrates. To bring this support up-to-date the new wire protocol will have to be supported.
  3. Storage and queries were good when written and remain operational for Mongo as of writing. However, the message formats are deprecated and not supported by all Mongo APIs. I'm speaking here of DocumentDB - while it might not be an explicit goal to support that DB if we can modernize the wire format to avoid future breakage then we'll get the DocumentDB as a bonus.

If all these sound reasonable to you then we can get to work addressing each issue.

VictorDenisov commented 4 years ago

Sounds like a solid plan. I'm actually happy to help you. I was just a bit reluctant developing anything without clear use case and without any evidence that anybody needs it. I created a project called Development. Feel free to create issues in that project for tracking progress. If you could create granular enough tickets then I can pick them up and work on them.

VictorDenisov commented 3 years ago

Hi @TomMD. Any movement on this PR? I presume this PR only demonstrates the problem and not fixes it.

TomMD commented 3 years ago

Sorry, work took me on other paths. We're not using mongo right now. If we did then it would be lots of work to get both the new command format (to support document db) and index creation working.

You are right that this PR only shows the problem and does not fix it.