---
title: "Discussion on \"Using MongoDB in Ktor.\" | Hashnode"
description: "Discussion on \"Using MongoDB in Ktor.\". Using a database layer in any backend application is important. In this blog, you are going to learn how to use MongoDB as your database."
url: "https://hashnode.com/posts/mongodb-in-ktor/60db92c57c7df7644acddf01"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Using MongoDB in Ktor.](https://himanshoe.com/mongodb-in-ktor?utm_source=hashnode&utm_medium=feed)

Using a database layer in any backend application is important. In this blog, you are going to learn how to use MongoDB as your database.

Jun 29, 2021 · 8 min read · himanshoe.com  
Updated Jul 1, 2021  
Read the article

-   [#mongodb](https://hashnode.com/tag/mongodb)
-   [#kotlin](https://hashnode.com/tag/kotlin)
-   [#backend](https://hashnode.com/tag/backend)
-   [#databases](https://hashnode.com/tag/databases)
-   [#database](https://hashnode.com/tag/database)

## Written by

[Himanshu Singh](https://hashnode.com/@himanshoe)

@himanshoe · India

  
[View profile](https://hashnode.com/@himanshoe)

Hustler. Coder. Learner

I am a Google developer expert for Android/Kotlin and a Full-Stack Engineer. I like to build and architect code stuff which can help people around the globe. Isn't that the meaning of life?

## Responses 5

Markdown supported · ⌘↵ to post

[MarcBush](https://hashnode.com/@DeniseErickson)

[Dec 8, 2022](https://hashnode.com/posts/mongodb-in-ktor/60db92c57c7df7644acddf01/comment/6391bdba0771b6e5cf4a7c41)

MongoDB is a NoSQL database. If you want to make use of the best features and methods of MongoDB then the recommendation is to use it together with Ktor. I prefer to check this [building washing auckland](https://www.aucklandgutter.co.nz/) and get more new tips for washing. In this article, we'll be looking at some of the popular integration points between these two technologies, what they are and how they can be used together to get the best out of both sides.

[hamza maqsood](https://hashnode.com/@hamzamaq)

[Apr 27, 2022](https://hashnode.com/posts/mongodb-in-ktor/60db92c57c7df7644acddf01/comment/6269a85caedfbdb0ce1a6671)

Once you select a service, you can select to host your infrastructure on a number of cloud providers: AWS, Google Cloud, Microsoft Azure, DigitalOcean, and UpCloud. You can also select a hosting plan, which determines how much memory and processor power your service can access. [chinese food restaurants near me](https://chinesebuffetnearmenow.net/chinese-takeout-near-me-foods/)

[Jasman Arora](https://hashnode.com/@RunnerShane)

[Oct 14, 2021](https://hashnode.com/posts/mongodb-in-ktor/60db92c57c7df7644acddf01/comment/6167c7d218374f257327871f)

The blog is awesome but when I try to run the app then I am getting the following exception

2021-10-14 11:22:37.244 \[cluster-ClusterId{value='6167c5a470b9a401ce681185', description='null'}-localhost:27017\] INFO org.mongodb.driver.cluster - Exception in monitor thread while connecting to server localhost:27017 com.mongodb.MongoSocketOpenException: Exception opening socket at com.mongodb.internal.connection.AsynchronousSocketChannelStream$OpenCompletionHandler.failed(AsynchronousSocketChannelStream.java:124) at java.base/sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:129) at java.base/sun.nio.ch.Invoker$2.run(Invoker.java:219) at java.base/sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: java.net.ConnectException: Connection refused at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.checkConnect(Native Method) at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finishConnect(UnixAsynchronousSocketChannelImpl.java:252) at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finish(UnixAsynchronousSocketChannelImpl.java:198) at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.onEvent(UnixAsynchronousSocketChannelImpl.java:213) at java.base/sun.nio.ch.EPollPort$EventHandlerTask.run(EPollPort.java:306) ... 1 common frames omitted

so can you help me solve this

[Raghav Awasthi](https://hashnode.com/@iamraghavawasthi)

[Jul 1, 2021](https://hashnode.com/posts/mongodb-in-ktor/60db92c57c7df7644acddf01/comment/60dda12a95305075b9339838)

Damnnn Awesome 😎

[Shreyas Patil](https://hashnode.com/@patilshreyas)

[Jun 30, 2021](https://hashnode.com/posts/mongodb-in-ktor/60db92c57c7df7644acddf01/comment/60dbf5257c7df7644acde428)

Good read

[Himanshu Singh](https://hashnode.com/@himanshoe)

[Jun 30, 2021](https://hashnode.com/posts/mongodb-in-ktor/60db92c57c7df7644acddf01/comment/60dbf5257c7df7644acde428#reply-60dbfbfc7ad49f6471acceb9)

Thanks [Shreyas Sharad Patil](https://hashnode.com/@patilshreyas)
