Kotlin coroutine support for MongoDB built on top of the official Reactive Streams Java Driver

Overview

fluid-mongo

Maven Central Kotlin MongoDB #fluid-libraries Slack Channel

Kotlin coroutine support for MongoDB built on top of the official MongoDB Reactive Streams Java Driver.

Installation

build.gradle.kts:

dependencies {
    implementation("io.fluidsonic.mongo:fluid-mongo:1.4.0")
}

Example

import io.fluidsonic.mongo.MongoClients
import org.bson.Document


suspend fun main() {
    val collection = MongoClients.create()
        .getDatabase("test")
        .getCollection("test")

    collection.insertOne(mapOf("hello" to "world"))    // suspending call
    collection.insertOne(mapOf("it's" to "so easy!"))  // suspending call

    collection.find().collect { document ->  // Kotlin Flow
        println(document)
    }
}

Output:

Document{{_id=5bb6b56f9cfa62686b5afc87, hello=world}}
Document{{_id=5bb6b56f9cfa62686b5afc88, it's=so easy!}}

License

Apache 2.0


Awesome Kotlin

You might also like...
A project to learn about Reactive Microservices experimenting with architectures and patterns
A project to learn about Reactive Microservices experimenting with architectures and patterns

reactive-microservices-workshop Copyright © 2021 Aleix Morgadas - Licenced under CC BY-SA 4.0 A project to learn about Reactive Microservices experime

Event-driven application uses React, reactive Spring Boot WebFlux, R2DBC, MySQL and Liquibase

Product delivery Event-driven application uses React, reactive Spring Boot WebFlux, R2DBC, MySQL and Liquibase Status: IN PROGRESS if [[ "" != `docker

New Relic Kotlin Instrumentation for Kotlin Coroutine. It successfully handles thread changes in suspend states.

new-relic-kotlin-coroutine New Relic Kotlin Instrumentation for Kotlin Coroutine. It successfully handles thread changes in suspend states. Usage 1- U

Saga pattern implementation in Kotlin build in top of Kotlin's Coroutines.

Module Saga Website can be found here Add in build.gradle.kts repositories { mavenCentral() } dependencies { implementation("io.github.nomisr

Android Multi Theme Switch Library ,use  kotlin language ,coroutine ,and so on ...
Android Multi Theme Switch Library ,use kotlin language ,coroutine ,and so on ...

Magic Mistletoe Android多主题(换肤)切换框架 背景 时隔四年,在网易换肤之前的思路下,做了几点改进,现在完全通过反射创建View,并且在SkinLoadManager中提供一个configCustomAttrs以支持自定义View的属性插队替换 摈弃了之前的AsyncTask

R2DBC Sharding Example with Kotlin Coroutine

R2DBC Sharding Example with Kotlin Coroutine A minimal sharding example with R2DBC and coroutine, where user table is divided into 2 different shards.

Kreds - a thread-safe, idiomatic, coroutine based Redis client written in 100% Kotlin

Kreds Kreds is a thread-safe, idiomatic, coroutine based Redis client written in 100% Kotlin. Why Kreds? Kreds is designed to be EASY to use. Kreds ha

Demonstration of Object Pool Design Pattern using Kotlin language and Coroutine
Demonstration of Object Pool Design Pattern using Kotlin language and Coroutine

Object Pool Design Pattern with Kotlin Demonstration of Thread Safe Object Pool Design Pattern using Kotlin language and Coroutine. Abstract The objec

Mobile client for official Nextcloud News App written as Kotlin Multiplatform Project
Mobile client for official Nextcloud News App written as Kotlin Multiplatform Project

Newsout Android and iOS mobile client for Nextcloud news App. The Android client is already available to download in the Play Store. F-Droid and Apple

Comments
  • No action.

    No action.

    Hello, i try insert some document and timeout code with println -> https://imgur.com/a/Qangnia

    Exception -> Exception in thread "main" com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches WritableServerSelector. Client view of cluster state is {type=UNKNOWN, servers=[{address=xxxxx:xxx, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.io.IOException: The remote computer refused the network connection }}] at com.mongodb.internal.connection.BaseCluster.createTimeoutException(BaseCluster.java:407) at com.mongodb.internal.connection.BaseCluster.handleServerSelectionRequest(BaseCluster.java:311) at com.mongodb.internal.connection.BaseCluster.access$800(BaseCluster.java:62) at com.mongodb.internal.connection.BaseCluster$WaitQueueHandler.run(BaseCluster.java:478) at java.lang.Thread.run(Thread.java:748)

    opened by TheMajster 3
  • Callback-based MongoDB Async Java Driver is deprecated since v3.9

    Callback-based MongoDB Async Java Driver is deprecated since v3.9

    I was about to start using KMongo on a new project when I decided to check some documentation on the underlying client and noticed it's deprecated since MongoDB Async/Reactive Java Driver v3.9 (now on 3.11). Here's my source: https://mongodb.github.io/mongo-java-driver/3.11/driver-async/#what-s-new-in-3-9 Maybe this lib should change to wrapping reactive streams?

    opened by Tmpod 2
  • where are the tests?

    where are the tests?

    Hello! I see no automatic tests in the repo.

    Do the tests exist? If so, where can I find them? If I want to contribute, how do I test the project.

    Thank you!

    opened by voddan 1
Releases(1.5.0)
Owner
Marc Knaup
❤️ tech / startups / crypto / travel
Marc Knaup
An android app using Mongodb for logistics tracking system.

DeliveryGo An android application for logistics tracking. Used technology Kotlin: In this project kotlin is used to code the full application on Andro

Joysankar Majumdar 1 Mar 5, 2022
Template to accelerate the creation of new apps using Spring Boot 3, MongoDB & GraphQL.

Template to accelerate the creation of new apps using Spring Boot 3, MongoDB & GraphQL.

André Ramon 1 Feb 13, 2022
User Authentication ( Compose Ktor Server MongoDB)

Utilising Security in android for Authentication and Authorization for Android I would be using mongo db to perform all basic operations no need for f

Michael Enoma 0 May 2, 2022
A sample skeleton backend app built using Spring Boot kotlin, Expedia Kotlin Graphql, Reactive Web that can be deployed to Google App Engine Flexible environmennt

spring-kotlin-gql-gae This is a sample skeleton of a backend app that was built using: Spring Boot(Kotlin) Reactive Web Sprinng Data R2DBC with MYSQL

Dario Mungoi 7 Sep 17, 2022
This repository contains event driven redis app uses redis streams

Spring Boot Redis Streams This repository contains event driven redis app uses redis streams Run redis in docker docker run --rm --name redis -itp6379

Maksim Kostromin 1 Dec 1, 2021
Kafka Streams Processor to unwrap CØSMOS blocks into CØSMOS transactions

Kafka Processor CØSMOS-Block A Kafka Streams Processor to unwrap CØSMOS blocks into CØSMOS transactions. Purpose The Kafka Processor CØSMOS-Block is b

OKP4 – Open Knowledge Protocol For 4 Dec 15, 2022
Spring-graphql-getting-started - Spring for GraphQL provides support for Spring applications built on GraphQL Java

Getting Started with GraphQL and Spring Boot Spring for GraphQL provides support

Shinya 0 Feb 2, 2022
Reactive setup with Spring WebFlux , Kotlin, Postgres and Spring Data R2DBC

Reactive Spring with Kotlin and Pg Spring WebFlux with Netty instead of Spring Web with Tomcat Mono and Flux in all layers (controller, service, repo)

Bimal Raj Gyawali 7 Dec 9, 2022
Showcase project of Functional Reactive Programming on Android, using RxJava.

FunctionalAndroidReference FunctionalAndroidReference is a showcase project of Functional Reactive Programming on Android, using RxJava. It's a compan

Paco 278 Nov 18, 2022
My personal template for a Spring Boot REST reactive webapp

My personal spring boot kotlin reactive template Features Spring Security implementation with JWT access and refresh token MongoDB database Project Co

Dušan 2 Dec 1, 2021