# .explain() result in ParseSwift

**URL:** <https://community.parseplatform.org/t/explain-result-in-parseswift/1557>\
**Category:** ParseSwift SDK\
**Tags:** query\
**Created:** [April 10, 2021, 5:51pm UTC](https://community.parseplatform.org/t/explain-result-in-parseswift/1557 "2021-04-10T17:51:29Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![cbaker6](https://community.parseplatform.org/user_avatar/community.parseplatform.org/cbaker6/32/114_2.png) [@cbaker6](https://community.parseplatform.org/u/cbaker6)\
**Post date:** [April 11, 2021, 2:12pm UTC](https://community.parseplatform.org/t/explain-result-in-parseswift/1557/6 "2021-04-11T14:12:50Z")

</div>

My guess is this is a bug on parse-server and not Parse-Swift and someone on the server team should probably pick up the Q&A here…

I say this because it doesn’t appear when using explain in Postgres. When I added `explain` to the Postgres adapter on the parse-server ([PR 6506](https://github.com/parse-community/parse-server/pull/6506)), I made sure it’s always returned in JSON format so it can always be decoded:

> <https://github.com/parse-community/parse-server/blob/45d00cee60d0b273591b5ee6ebe7c9b610fae26e/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js#L827-L833>

~~Looking at the `explain` results you’ve shown along with some of my own testing, the Mongo version of explain isn’t always returning a JSON version of `explain`. CloudCode and the JS SDK most likely show results fine in because JS isn’t a strongly typed language and isn’t trying to decode JSON to specific types. Conversely, Swift is, and expects everything from the server to be in a “correct” JSON format or else it throws errors. The mongo version of `explain` doesn’t appear to be in a correct JSON format.~~

Update: the problem is a mongo `explain` isn’t being returned within a JSON array.

If what I said above is true (the server team will need to confirm), there will most likely need to be a fix in this file [parse-server/MongoStorageAdapter.js at master · parse-community/parse-server · GitHub](https://github.com/parse-community/parse-server/blob/master/src/Adapters/Storage/Mongo/MongoStorageAdapter.js). I found some info about explain in mongo (but I don’t use it, so I won’t be able to provide any additional insight beyond this): [explain — MongoDB Manual](https://docs.mongodb.com/manual/reference/command/explain/)

A workaround could be to use your Cloud Code explain function and only return the fields your care about to Parse-Swift.

---

_[View the full topic](https://community.parseplatform.org/t/explain-result-in-parseswift/1557)._
