# Is that a normal practice to use direct access to MongoDB?

**URL:** <https://community.parseplatform.org/t/is-that-a-normal-practice-to-use-direct-access-to-mongodb/878>\
**Category:** Parse Server 📡\
**Tags:** mongodb\
**Created:** [September 25, 2020, 8:42pm UTC](https://community.parseplatform.org/t/is-that-a-normal-practice-to-use-direct-access-to-mongodb/878 "2020-09-25T20:42:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andy](https://community.parseplatform.org/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@Andy](https://community.parseplatform.org/u/Andy)\
**Post date:** [September 25, 2020, 8:42pm UTC](https://community.parseplatform.org/t/is-that-a-normal-practice-to-use-direct-access-to-mongodb/878/1 "2020-09-25T20:42:11Z")

</div>

Is that a normal practice to use direct access to MongoDB for complicated requests bypassing Parse wrapper?

---

<div class="post-metadata">

**Author:** ![davimacedo](https://community.parseplatform.org/user_avatar/community.parseplatform.org/davimacedo/32/316_2.png) [@davimacedo](https://community.parseplatform.org/u/davimacedo)\
**Post date:** [September 25, 2020, 11:28pm UTC](https://community.parseplatform.org/t/is-that-a-normal-practice-to-use-direct-access-to-mongodb/878/2 "2020-09-25T23:28:55Z")

</div>

I’d try to keep all the queries as much as possible through Parse. You can also use [aggregate](https://docs.parseplatform.org/js/guide/#aggregate), which give you a lot more flexibility. Could you give an example of query that you wanted to bypass Parse and why?

---

<div class="post-metadata">

**Author:** ![Andy](https://community.parseplatform.org/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@Andy](https://community.parseplatform.org/u/Andy)\
**Post date:** [September 25, 2020, 11:58pm UTC](https://community.parseplatform.org/t/is-that-a-normal-practice-to-use-direct-access-to-mongodb/878/3 "2020-09-25T23:58:36Z")

</div>

That is more for the future, not for existing cases. I will try to use only Parse API of course. I have the case where I must use transaction in a good way but put aside it at this moment. You wrote that transactions “[supported via REST API](https://community.parseplatform.org/t/are-transactions-implemented-for-js-parse-sdk/788/2)” and I wanted an alternative. And alternative for whatever may be.

---

<div class="post-metadata">

**Author:** ![oallouch](https://community.parseplatform.org/user_avatar/community.parseplatform.org/oallouch/32/38_2.png) [@oallouch](https://community.parseplatform.org/u/oallouch)\
**Post date:** [September 26, 2020, 10:54am UTC](https://community.parseplatform.org/t/is-that-a-normal-practice-to-use-direct-access-to-mongodb/878/4 "2020-09-26T10:54:54Z")

</div>

You usually don’t. I used to use it for aggregation, but now it’s included.  
I still use it for searches that use collation indexes. Those queries only return ids, then I do a standard Parse query.  
Oh, and I still use it to login on the server (and get a sessionToken) and getting a user from a sessionToken. Maybe it’s possible using standard Parse API, but I don’t know how.

---

<div class="post-metadata">

**Author:** ![andreisu](https://community.parseplatform.org/user_avatar/community.parseplatform.org/andreisu/32/1414_2.png) [@andreisu](https://community.parseplatform.org/u/andreisu)\
**Post date:** [February 9, 2023, 8:48am UTC](https://community.parseplatform.org/t/is-that-a-normal-practice-to-use-direct-access-to-mongodb/878/5 "2023-02-09T08:48:01Z")

</div>

Parse.User.login() retrieves the session token and user data automatically and saves them to local storage.

```auto
await Parse.User.logIn(data.email, data.password, {
   success: onSuccess(),
});

```

---

<div class="post-metadata">

**Author:** ![oallouch](https://community.parseplatform.org/user_avatar/community.parseplatform.org/oallouch/32/38_2.png) [@oallouch](https://community.parseplatform.org/u/oallouch)\
**Post date:** [February 9, 2023, 2:19pm UTC](https://community.parseplatform.org/t/is-that-a-normal-practice-to-use-direct-access-to-mongodb/878/6 "2023-02-09T14:19:37Z")

</div>

logIn can indeed be used on the server, to get a sessionToken, but there’s no local storage on the server 🙂
