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

Parse creates incorrect index for pointer columns #4719

Closed
ClaireNeveu opened this issue Apr 12, 2018 · 4 comments
Closed

Parse creates incorrect index for pointer columns #4719

ClaireNeveu opened this issue Apr 12, 2018 · 4 comments

Comments

@ClaireNeveu
Copy link
Contributor

Issue Description

Describe your issue in as much detail as possible.

Steps to reproduce

  1. Create a collection of the name Foo with a column testCol which is a Pointer to Foo (or any class)
  2. curl -X PUT http://localhost:7345/1/schemas/Foo -H 'content-type: application/json' -H "X-Parse-Application-Id: the_application_id" -H "X-Parse-Master-Key: the_master_key" -d '{"className":"Foo","indexes":{"testestest":{"testCol":1}}}'

Expected Results

Parse creates a mongo index on _p_testCol (the backing field of testCol).

Actual Outcome

Parse creates a mongo index on testCol (which doesn't exist in the mongo documents)

> db.getCollection('Foo').getIndexes()
[
	{
		"v" : 1,
		"key" : {
			"_id" : 1
		},
		"name" : "_id_",
		"ns" : "parse.Foo"
	},
	{
		"v" : 1,
		"key" : {
			"testCol" : 1
		},
		"name" : "testestest",
		"ns" : "parse.Foo"
	}
]

Environment Setup

  • Server

    • parse-server version: 2.7.4
    • Operating System: Arch Linux
    • Hardware: Thinkpad
    • Localhost or remote server? (AWS): localhost
  • Database

    • MongoDB version: 3.2
    • Storage engine:
rs0:PRIMARY> db.serverStatus().storageEngine
{
	"name" : "wiredTiger",
	"supportsCommittedReads" : true,
	"readOnly" : false,
	"persistent" : true
}
  • Hardware: Same as above
  • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): Same as above
@ClaireNeveu
Copy link
Contributor Author

ClaireNeveu commented Apr 25, 2018

Updating this now that #4738 is merged to note that the indices created for objectId, createdAt, and other default fields are likewise incorrect. We'll want to use https://github.com/parse-community/parse-server/blob/master/src/Adapters/Storage/Mongo/MongoTransform.js when creating Mongo indices to handle all these cases.

@dplewis
Copy link
Member

dplewis commented May 2, 2018

@ClaireNeveu I've added a fix to this in #4629

@ClaireNeveu
Copy link
Contributor Author

@dplewis In your PR shouldn't the _id_ index be { objectId: 1 } instead of { _id: 1 }?

@stale
Copy link

stale bot commented Sep 18, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Sep 18, 2018
@stale stale bot closed this as completed Sep 25, 2018
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

No branches or pull requests

2 participants