This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.bson.Document | |
import com.mongodb.ConnectionString | |
import com.mongodb.MongoClientSettings | |
import com.mongodb.ServerApi | |
import com.mongodb.ServerApiVersion | |
import com.mongodb.kotlin.client.coroutine.MongoClient | |
import kotlinx.coroutines.runBlocking | |
object MongoClientConnectionExample { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.mongodb.kotlin.client.coroutine.MongoClient | |
import kotlinx.coroutines.runBlocking | |
import org.bson.Document | |
object MongoClientConnectionExample { | |
fun main() { | |
// Replace the placeholders with your credentials and hostname | |
val connectionString = "mongodb+srv://<username>:<password>@<svrHostName>"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.mongodb.kotlin.client.MongoClient | |
import org.bson.Document | |
object MongoClientConnectionExample { | |
fun main() { | |
// Replace the placeholders with your credentials and hostname | |
val connectionString = "mongodb+srv://<username>:<password>@<svrHostName>"; | |
// Create a new client and connect to the server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.bson.Document | |
import com.mongodb.ConnectionString | |
import com.mongodb.MongoClientSettings | |
import com.mongodb.ServerApi | |
import com.mongodb.ServerApiVersion | |
import com.mongodb.kotlin.client.MongoClient | |
object MongoClientConnectionExample { | |
fun main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.mongodb.{ServerApi, ServerApiVersion} | |
import org.mongodb.scala.{ConnectionString, MongoClient, MongoClientSettings} | |
import org.mongodb.scala.bson.Document | |
import scala.concurrent.Await | |
import scala.concurrent.duration.DurationInt | |
import scala.util.Using | |
object MongoClientConnectionExample { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.mongodb.scala.MongoClient | |
import org.mongodb.scala.bson.Document | |
import scala.concurrent.Await | |
import scala.concurrent.duration.DurationInt | |
import scala.util.Using | |
object MongoClientConnectionExample { | |
def main(args: Array[String]): Unit = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.reflect.Array; | |
import java.lang.reflect.InvocationHandler; | |
import java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.Method; | |
import java.lang.reflect.Proxy; | |
import java.util.ArrayList; | |
import java.util.List; | |
import com.sun.javadoc.Doc; | |
import com.sun.javadoc.DocErrorReporter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MongoClientSettings expected = MongoClientSettings.builder() | |
.applyToClusterSettings(new Block<ClusterSettings.Builder>() { | |
@Override | |
void apply(final ClusterSettings.Builder builder) { | |
builder.hosts([new ServerAddress('host1', 1), new ServerAddress('host2', 2)]) | |
.mode(ClusterConnectionMode.MULTIPLE) | |
.requiredReplicaSetName('test') | |
.serverSelectionTimeout(25000, TimeUnit.MILLISECONDS) | |
.maxWaitQueueSize(10 * 7) // maxPoolSize * waitQueueMultiple | |
.localThreshold(30, TimeUnit.MILLISECONDS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example; | |
import org.bson.BsonBinaryReader; | |
import org.bson.BsonBinaryWriter; | |
import org.bson.Document; | |
import org.bson.codecs.Codec; | |
import org.bson.codecs.DecoderContext; | |
import org.bson.codecs.DocumentCodec; | |
import org.bson.codecs.EncoderContext; | |
import org.bson.io.BasicOutputBuffer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example; | |
public abstract class SomeAbstractClass { | |
SomeAbstractClass(){} | |
/** | |
* The name of the SomeAbstractClass instance. | |
* | |
* @return the name |
NewerOlder