This file contains hidden or 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
/* | |
* Copyright 2023 MongoDB, Inc. | |
*/ | |
import com.mongodb.AutoEncryptionSettings; | |
import com.mongodb.ClientEncryptionSettings; | |
import com.mongodb.MongoClientSettings; | |
import com.mongodb.client.MongoClients; | |
import com.mongodb.client.MongoDatabase; | |
import com.mongodb.client.model.vault.EncryptOptions; |
This file contains hidden or 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.ConnectionString; | |
import com.mongodb.MongoClientSettings; | |
import com.mongodb.MongoException; | |
import com.mongodb.client.MongoClient; | |
import com.mongodb.client.MongoClients; | |
import com.mongodb.client.MongoDatabase; | |
import org.bson.Document; | |
public class MongoClientConnectionExample { | |
public static void main(String[] args) { |
This file contains hidden or 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.ConnectionString; | |
import com.mongodb.MongoClientSettings; | |
import com.mongodb.MongoException; | |
import com.mongodb.ServerApi; | |
import com.mongodb.ServerApiVersion; | |
import com.mongodb.client.MongoClient; | |
import com.mongodb.client.MongoClients; | |
import com.mongodb.client.MongoDatabase; | |
import org.bson.Document; |
This file contains hidden or 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
/* | |
* Copyright (c) 2008 - 2013 10gen, Inc. <http://10gen.com> | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains hidden or 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
dictionary = open('/usr/share/dict/words') | |
letters = ['n', 'j', 'u', 'l', 'r', 'o', 'a'] | |
center = 'a' | |
def contains_bad_letters(word): | |
for letter in word: | |
if letter not in letters: | |
return True | |
return False |
This file contains hidden or 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
{ | |
"$reduce": { // 300 | |
"input": { // [2, 4, 6, 8, 10] | |
"$map": { // [2, 4, 6, 8, 10] | |
"input": { // [2, 4, 6, 8, 10] | |
"$filter": { // [2, 4, 6, 8, 10] | |
"input": "$numList", // [1, 2, 3, 4, 5, 6, 7, 8, 9. 10] | |
"cond": { | |
"$eq": [ // [false, true, false, true, false, true, false, true, false, true] | |
{ |
This file contains hidden or 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.client.MongoClients; | |
import org.bson.BsonDocument; | |
import org.bson.BsonTimestamp; | |
import org.bson.Document; | |
import java.nio.ByteBuffer; | |
import java.nio.ByteOrder; | |
import java.time.ZoneId; | |
import java.time.ZonedDateTime; | |
import java.time.format.DateTimeFormatter; |
This file contains hidden or 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.client.MongoClients; | |
import org.bson.BsonDocument; | |
import org.bson.BsonTimestamp; | |
import org.bson.Document; | |
import java.nio.ByteBuffer; | |
import java.nio.ByteOrder; | |
import java.time.ZoneId; | |
import java.time.ZonedDateTime; | |
import java.time.format.DateTimeFormatter; |
This file contains hidden or 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.client.MongoClients; | |
import org.bson.BsonDocument; | |
import org.bson.BsonTimestamp; | |
import org.bson.Document; | |
import java.nio.ByteBuffer; | |
import java.nio.ByteOrder; | |
import java.time.ZoneId; | |
import java.time.ZonedDateTime; | |
import java.time.format.DateTimeFormatter; |
This file contains hidden or 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 com.mongodb.client; | |
import java.time.Duration; | |
import java.util.Optional; | |
public class TimeoutScope implements AutoCloseable { | |
private static final ThreadLocal<TimeoutScope> THREAD_LOCAL_TIMEOUT_SCOPE = new ThreadLocal<>(); | |
public static TimeoutScope withDuration(final Duration duration) { | |
if (THREAD_LOCAL_TIMEOUT_SCOPE.get() != null) { |