Skip to content

Newest Version Breaks Compound MongoDB Text Indices #4212

Closed
@seriph

Description

@seriph

Issue Description

Just updated our backend to the newest code, and looks like the text index support is faulty when you're using Mongo. Specifically, the code from this commit:
5aafc93

Automatic index creation does not account for compound text indices and will simply iterate through all columns queried for text and try to create an index for each, which isn't how compound indices work on Mongo. I've been running Parse Server with my own text query functionality in production since April, and tried syncing with upstream today but had to comment this out to get it to work.

We worked together on text queries back in June, and the code at that point was fine (the JS API was implemented weirdly, in that it requires a column to query on text even though Mongo itself doesn't, but it worked fine). This update breaks it if you're using compound text indices.

I'm not sure the current approach is workable in the case of compound indices without adding extra per-query overhead to check for them. IMO it would be better if, in the case of a Mongo backend, we allow the user to be completely responsible for text index creation.

Steps to reproduce

Try to query on a text index when using Mongo.

Expected Results

Expect to work.

Actual Outcome

Failing with 'Only one text index is supported, please delete all text indexes to use new field.' introduced by the above commit.

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : 2.6.2
    • Operating System: Ubuntu
    • Hardware: An epic server
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): Heroku
  • Database

    • MongoDB version: 3.4.5 (WiredTiger)
    • Storage engine: WiredTiger
    • Hardware: Too many servers.
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): mLab

Logs/Trace

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:questionSupport or code-level question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions