Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Indexing methods in parse for _rperm

In trying to understand how Parse indexes work with Mongo, I noticed that some of my slow queries were using the _rperm field (from the ACL) even though I didn't specify it in the indexes that I defined. It isn't on every query either so I'm wondering why some queries need _rperm indexed and some don't.

If I query by just the id, the index seems to require {"_id": 1, "_rperm": 1} and not just the {"_id": 1} index that is already defined.

What does parse do in the background to add _rperm and when do I need to include it as an index?

like image 206
Tyler Slater Avatar asked Jul 29 '16 15:07

Tyler Slater


1 Answers

The reason for the inconsistent use of the _rperm index is due to the use of useMasterKey in the cloud code.

If you use the master key with the query then it won't require to check the ACL. But, if you don't use master key in your query, you will need to index the _rperm field on your collections in order for that query to run efficiently.

like image 164
Tyler Slater Avatar answered Nov 01 '22 18:11

Tyler Slater