100+ results for 'mongodb lang:java'
Not the results you expected?
ClusterDescription.java (git://github.com/mongodb/mongo-java-driver.git) Java · 336 lines
1 /*
2 * Copyright 2008-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.connection;
19 import com.mongodb.MongoException;
20 import com.mongodb.ReadPreference;
21 import com.mongodb.annotations.Immutable;
22 import com.mongodb.internal.selector.ReadPreferenceServerSelector;
23 import com.mongodb.internal.selector.WritableServerSelector;
FindIterableImpl.java (git://github.com/mongodb/mongo-java-driver.git) Java · 216 lines
1 /*
2 * Copyright (c) 2008-2014 MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb;
19 import com.mongodb.client.FindIterable;
20 import com.mongodb.client.MongoCursor;
21 import com.mongodb.client.MongoIterable;
22 import com.mongodb.client.model.Collation;
23 import com.mongodb.client.model.FindOptions;
TestCase.java
(git://github.com/mongodb/mongo-java-driver.git)
Java · 278 lines
✨ Summary
This Java code is a test framework for MongoDB, allowing users to write unit tests for their classes. It scans for test classes in a specified directory, runs each test method, and reports the results, including any errors or failures. The output includes a summary of the number of passed and failed tests, as well as detailed error messages.
This Java code is a test framework for MongoDB, allowing users to write unit tests for their classes. It scans for test classes in a specified directory, runs each test method, and reports the results, including any errors or failures. The output includes a summary of the number of passed and failed tests, as well as detailed error messages.
17 */
19 package com.mongodb.util;
21 import java.io.BufferedReader;
27 import java.util.List;
29 import com.mongodb.Mongo;
31 public class TestCase extends MyAsserts {
211 }
213 if ( ste.getClassName().equals( "com.mongodb.util.TestCase" ) &&
214 ste.getMethodName().equals( "run" ) )
215 foundMe = true;
MongoConnectionImpl.java (git://github.com/suguru/mongo-java-async-driver.git) Java · 303 lines
BulkOperations.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 166 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.core;
18 import java.util.List;
20 import org.springframework.data.mongodb.core.query.Query;
21 import org.springframework.data.mongodb.core.query.Update;
22 import org.springframework.data.util.Pair;
24 import com.mongodb.bulk.BulkWriteResult;
26 /**
27 * Bulk operations for insert/update/remove actions on a collection. These bulks operation are available since MongoDB
28 * 2.6 and make use of low level bulk commands on the protocol level. This interface defines a fluent API to add
29 * multiple single operations or list of similar operations in sequence which can then eventually be executed by calling
ClientSessionBinding.java (https://github.com/mongodb/mongo-java-driver.git) Java · 229 lines
1 /*
2 * Copyright 2008-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.async.client;
19 import com.mongodb.ReadConcern;
20 import com.mongodb.ReadPreference;
21 import com.mongodb.async.SingleResultCallback;
22 import com.mongodb.binding.AsyncClusterBinding;
23 import com.mongodb.binding.AsyncConnectionSource;
OperationIterable.java (git://github.com/mongodb/mongo-java-driver.git) Java · 159 lines
1 /*
2 * Copyright (c) 2008-2014 MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.async.client;
19 import com.mongodb.Block;
20 import com.mongodb.Function;
21 import com.mongodb.ReadPreference;
22 import com.mongodb.async.AsyncBatchCursor;
23 import com.mongodb.async.SingleResultCallback;
PaymentReconciliation.java (https://bitbucket.org/piyushgd10/bhumi.git) Java · 286 lines
DecoderBench.java (git://github.com/bguerout/jongo.git) Java · 79 lines
ExecutableInsertOperationSupport.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 139 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.core;
18 import java.util.ArrayList;
19 import java.util.Collection;
21 import org.springframework.data.mongodb.core.BulkOperations.BulkMode;
22 import org.springframework.lang.Nullable;
23 import org.springframework.util.Assert;
123 /*
124 * (non-Javadoc)
125 * @see org.springframework.data.mongodb.core.ExecutableInsertOperation.InsertWithBulkMode#withBulkMode(org.springframework.data.mongodb.core.BulkMode)
126 */
127 @Override
SingleConnectionBinding.java (git://github.com/mongodb/mongo-java-driver.git) Java · 153 lines
1 /*
2 * Copyright (c) 2008-2014 MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.binding;
19 import com.mongodb.ReadPreference;
20 import com.mongodb.connection.Cluster;
21 import com.mongodb.connection.Connection;
22 import com.mongodb.connection.Server;
23 import com.mongodb.connection.ServerDescription;
EnableReactiveMongoRepositories.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 143 lines
15 */
17 package org.springframework.data.mongodb.repository.config;
19 import java.lang.annotation.Documented;
27 import org.springframework.context.annotation.ComponentScan.Filter;
28 import org.springframework.context.annotation.Import;
29 import org.springframework.data.mongodb.core.MongoTemplate;
30 import org.springframework.data.mongodb.repository.support.MongoRepositoryFactoryBean;
31 import org.springframework.data.mongodb.repository.support.ReactiveMongoRepositoryFactoryBean;
32 import org.springframework.data.repository.config.DefaultRepositoryBaseClass;
33 import org.springframework.data.repository.query.QueryLookupStrategy;
36 /**
37 * Annotation to activate reactive MongoDB repositories. If no base package is configured through either
38 * {@link #value()}, {@link #basePackages()} or {@link #basePackageClasses()} it will trigger scanning of the package of
39 * annotated class.
ReflectionDBObject.java (https://github.com/fes/mongo-java-driver.git) Java · 249 lines
GridFSDBFile.java (git://github.com/mongodb/mongo-java-driver.git) Java · 203 lines
1 /*
2 * Copyright (c) 2008-2014 MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.gridfs;
19 import com.mongodb.BasicDBObject;
20 import com.mongodb.DBObject;
21 import com.mongodb.MongoException;
34 * </ul>
35 *
36 * @mongodb.driver.manual core/gridfs/ GridFS
37 */
38 public class GridFSDBFile extends GridFSFile {
TaskFactoryUnitTests.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 81 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.core.messaging;
18 import static org.assertj.core.api.Assertions.*;
26 import org.mockito.junit.jupiter.MockitoExtension;
28 import org.springframework.data.mongodb.core.MongoTemplate;
29 import org.springframework.data.mongodb.core.convert.MongoConverter;
30 import org.springframework.data.mongodb.core.messaging.ChangeStreamRequest.ChangeStreamRequestOptions;
31 import org.springframework.data.mongodb.core.messaging.SubscriptionRequest.RequestOptions;
JJTMQLState.java (git://github.com/geir/mongo-java-driver.git) Java · 140 lines
CompositeByteBuf.java (git://github.com/mongodb/mongo-java-driver.git) Java · 344 lines
ServiceDao.java (https://gitlab.com/BGCX261/zonales-svn-to-git.git) Java · 157 lines
MongoNonDocumentResourceStorage.java (git://github.com/lucmoreau/ProvToolbox.git) Java · 114 lines
1 package org.openprovenance.prov.storage.mongodb;
3 import com.fasterxml.jackson.databind.ObjectMapper;
4 import com.mongodb.*;
5 import org.apache.commons.io.IOUtils;
6 import org.apache.log4j.Logger;
10 import java.io.*;
11 /* Documentation
12 https://howtodoinjava.com/mongodb/java-mongodb-getsave-image-using-gridfs-apis/
13 */
CreateCosmosDBWithKindMongoDB.java (git://github.com/WindowsAzure/azure-sdk-for-java.git) Java · 122 lines
20 /**
21 * Azure CosmosDB sample for high availability.
22 * - Create a CosmosDB configured with MongoDB kind.
23 * - Get the mongodb connection string
24 * - Delete the CosmosDB.
25 */
26 public final class CreateCosmosDBWithKindMongoDB {
27 static final String DATABASE_ID = "TestDB";
28 static final String COLLECTION_ID = "TestCollection";
54 Utils.print(cosmosDBAccount);
56 System.out.println("Get the MongoDB connection string");
57 DatabaseAccountListConnectionStringsResult databaseAccountListConnectionStringsResult = cosmosDBAccount.listConnectionStrings();
58 System.out.println("MongoDB connection string: "
118 }
120 private CreateCosmosDBWithKindMongoDB() {
121 }
122 }
ReplPairTest.java
(git://github.com/mongodb/mongo-java-driver.git)
Java · 88 lines
✨ Summary
This Java code creates a test for replication pairs in MongoDB by starting multiple threads that continuously query and update a collection on two different servers, simulating a replication pair. The main thread updates the document and prints the result every 500 milliseconds. If an exception occurs, it catches and prints the error message.
This Java code creates a test for replication pairs in MongoDB by starting multiple threads that continuously query and update a collection on two different servers, simulating a replication pair. The main thread updates the document and prints the result every 500 milliseconds. If an exception occurs, it catches and prints the error message.
FastMapper.java (https://bitbucket.org/yangibaev/g6) Java · 189 lines
SimpleMongoRepositoryConfiguration.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 197 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.repository.config;
18 import org.springframework.data.mongodb.repository.support.MongoRepositoryFactoryBean;
50 /**
51 * Returns the bean name of the {@link org.springframework.data.mongodb.core.core.MongoTemplate} to be referenced.
52 *
53 * @return
137 * (non-Javadoc)
138 *
139 * @see org.springframework.data.mongodb.repository.config.
140 * SimpleMongoRepositoryConfiguration
141 * .MongoRepositoryConfiguration#getMongoTemplateRef()
MongoInputFormat.java (git://github.com/mongodb/mongo-hadoop.git) Java · 73 lines
16 */
18 package com.mongodb.hadoop.mapred;
20 import java.util.*;
22 import com.mongodb.hadoop.input.*;
23 import com.mongodb.hadoop.mapred.input.MongoInputSplit;
24 import com.mongodb.hadoop.mapred.input.MongoRecordReader;
25 import com.mongodb.hadoop.util.*;
34 import org.bson.*;
36 import com.mongodb.hadoop.MongoConfig;
37 import com.mongodb.hadoop.mapred.input.*;
CriteriaTests.java (https://gitlab.com/javajamesb08/spring-data-mongodb.git) Java · 167 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.core.query;
18 import static org.hamcrest.CoreMatchers.*;
21 import org.junit.Test;
22 import org.springframework.data.mongodb.InvalidMongoDbApiUsageException;
24 import com.mongodb.BasicDBObject;
25 import com.mongodb.BasicDBObjectBuilder;
26 import com.mongodb.DBObject;
60 }
62 @Test(expected = InvalidMongoDbApiUsageException.class)
63 public void testCriteriaWithMultipleConditionsForSameKey() {
64 Criteria c = new Criteria("name").gte("M").and("name").ne("A");
ServerVersionHelper.java (git://github.com/mongodb/mongo-java-driver.git) Java · 99 lines
DefaultMessageListenerContainerUnitTests.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 297 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.core.messaging;
18 import static edu.umd.cs.mtc.TestFramework.*;
31 import org.springframework.dao.DataAccessResourceFailureException;
32 import org.springframework.data.mongodb.core.MongoTemplate;
33 import org.springframework.util.ErrorHandler;
AsyncConnection.java (https://github.com/mongodb/mongo-java-driver.git) Java · 224 lines
1 /*
2 * Copyright 2008-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.connection;
19 import com.mongodb.MongoNamespace;
20 import com.mongodb.ReadPreference;
21 import com.mongodb.WriteConcernResult;
22 import com.mongodb.annotations.ThreadSafe;
23 import com.mongodb.async.SingleResultCallback;
MongoParametersParameterAccessorUnitTests.java (https://gitlab.com/javajamesb08/spring-data-mongodb.git) Java · 107 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.repository.query;
18 import static org.hamcrest.CoreMatchers.*;
27 import org.springframework.data.geo.Metrics;
28 import org.springframework.data.geo.Point;
29 import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
30 import org.springframework.data.mongodb.core.query.TextCriteria;
31 import org.springframework.data.mongodb.repository.Person;
32 import org.springframework.data.repository.Repository;
33 import org.springframework.data.repository.core.RepositoryMetadata;
MongoRepositoryConfigurationExtensionUnitTests.java (https://gitlab.com/javajamesb08/spring-data-mongodb.git) Java · 116 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.repository.config;
18 import static org.junit.Assert.*;
26 import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
27 import org.springframework.core.type.StandardAnnotationMetadata;
28 import org.springframework.data.mongodb.core.mapping.Document;
29 import org.springframework.data.mongodb.repository.MongoRepository;
AuditablePerson.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 70 lines
ReactiveAfterConvertCallback.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 44 lines
BsonArray.java (git://github.com/mongodb/mongo-java-driver.git) Java · 267 lines
1 /*
2 * Copyright 2008-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
76 /**
77 * Parses a string in MongoDB Extended JSON format to a {@code BsonArray}
78 *
79 * @param json the JSON string
80 * @return a corresponding {@code BsonArray} object
81 * @see org.bson.json.JsonReader
82 * @mongodb.driver.manual reference/mongodb-extended-json/ MongoDB Extended JSON
83 *
84 * @since 3.4
HealthIndicatorAutoConfiguration.java (https://gitlab.com/luyuwww/spring-boot.git) Java · 259 lines
MainWindow.java (http://mongodb-shell.googlecode.com/svn/trunk/) Java · 125 lines
1 package org.smartapp.mongodb.ui;
3 import java.awt.BorderLayout;
14 import javax.swing.JTabbedPane;
16 import org.smartapp.mongodb.config.ConnectionConfig;
17 import org.smartapp.mongodb.console.Console;
18 import org.smartapp.mongodb.console.TextAreaConsoleImpl;
20 import com.mongodb.Mongo;
35 public MainWindow() {
37 super("mongodb-shell " + VERSION);
39 console = new TextAreaConsoleImpl();
Dumpster.java (https://bitbucket.org/jochristo/dumpster-springboot-2.0.git) Java · 177 lines
18 import org.joko.core.jsonapi.annotations.JAPIType;
19 import org.joko.core.jsonapi.serializers.JsonDateFormatSerializer;
20 import org.mongodb.morphia.annotations.Entity;
21 import org.springframework.data.annotation.Id;
22 import org.springframework.data.mongodb.core.mapping.Document;
23 import org.springframework.data.mongodb.core.mapping.Field;
25 /**
LazyDBList.java (git://github.com/mongodb/mongo-java-driver.git) Java · 60 lines
DistinctIterable.java (git://github.com/mongodb/mongo-java-driver.git) Java · 60 lines
1 /*
2 * Copyright 2015 MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.async.client;
35 * @param filter the filter, which may be null.
36 * @return this
37 * @mongodb.driver.manual reference/method/db.collection.find/ Filter
38 */
39 DistinctIterable<TResult> filter(Bson filter);
53 * @param batchSize the batch size
54 * @return this
55 * @mongodb.driver.manual reference/method/cursor.batchSize/#cursor.batchSize Batch Size
56 */
57 DistinctIterable<TResult> batchSize(int batchSize);
RenameCollectionOptions.java (git://github.com/mongodb/mongo-java-driver.git) Java · 54 lines
1 /*
2 * Copyright 2008-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.client.model;
19 /**
20 * The options to apply when renaming a collection.
21 *
22 * @mongodb.driver.manual reference/command/renameCollection renameCollection
23 * @since 3.0
24 */
DatabaseTestCase.java (git://github.com/mongodb/mongo-java-driver.git) Java · 55 lines
1 /*
2 * Copyright (c) 2008-2014 MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb;
19 import org.junit.After;
20 import org.junit.Before;
22 import static com.mongodb.Fixture.getDefaultDatabaseName;
23 import static com.mongodb.Fixture.getMongoClient;
Binary.java (git://github.com/mongodb/mongo-java-driver.git) Java · 117 lines
MongoStorageHandlerTest.java (git://github.com/mongodb/mongo-hadoop.git) Java · 110 lines
LatencyMinimizingServerSelectorTest.java (git://github.com/mongodb/mongo-java-driver.git) Java · 91 lines
1 /*
2 * Copyright 2008-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.internal.selector;
19 import com.mongodb.ServerAddress;
20 import com.mongodb.connection.ClusterDescription;
21 import com.mongodb.connection.ServerDescription;
22 import com.mongodb.connection.ServerType;
23 import org.junit.Test;
CountQuery.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 227 lines
RelationKind.java (https://repo.or.cz/Tadpole.git) Java · 272 lines
Fixture.java (git://github.com/mongodb/mongo-java-driver.git) Java · 180 lines
19 import com.mongodb.ClusterFixture;
20 import com.mongodb.ConnectionString;
21 import com.mongodb.MongoClientSettings;
22 import com.mongodb.MongoCommandException;
23 import com.mongodb.MongoInterruptedException;
24 import com.mongodb.MongoNamespace;
25 import com.mongodb.MongoTimeoutException;
26 import com.mongodb.async.FutureResultCallback;
27 import com.mongodb.connection.AsynchronousSocketChannelStreamFactoryFactory;
28 import com.mongodb.connection.StreamFactoryFactory;
64 public static com.mongodb.MongoClientSettings.Builder getMongoClientBuilderFromConnectionString() {
65 com.mongodb.MongoClientSettings.Builder builder = com.mongodb.MongoClientSettings.builder()
66 .applyConnectionString(getConnectionString());
67 builder.streamFactoryFactory(getStreamFactoryFactory());
ByteBufBsonDocument.java (git://github.com/mongodb/mongo-java-driver.git) Java · 173 lines
MongoSplitterFactory.java (git://github.com/mongodb/mongo-hadoop.git) Java · 131 lines
ObjectOperators.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 298 lines
134 * @author Christoph Strobl
135 * @see <a href=
136 * "https://docs.mongodb.com/manual/reference/operator/aggregation/mergeObjects/">https://docs.mongodb.com/manual/reference/operator/aggregation/mergeObjects/</a>
137 * @since 2.1
138 */
209 /*
210 * (non-Javadoc)
211 * @see org.springframework.data.mongodb.core.aggregation.AbstractAggregationExpression#toDocument(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
212 */
213 @Override
246 * @author Christoph Strobl
247 * @see <a href=
248 * "https://docs.mongodb.com/manual/reference/operator/aggregation/objectToArray/">https://docs.mongodb.com/manual/reference/operator/aggregation/objectToArray/</a>
249 * @since 2.1
250 */
Reservation.java (https://bitbucket.org/jochristo/dumpster-springboot-2.0.git) Java · 154 lines
19 import org.joko.core.jsonapi.annotations.JAPIType;
20 import org.joko.core.jsonapi.serializers.JsonDateFormatSerializer;
21 import org.mongodb.morphia.annotations.Entity;
22 import org.springframework.data.annotation.Id;
23 import org.springframework.data.mongodb.core.mapping.DBRef;
24 import org.springframework.data.mongodb.core.mapping.Document;
25 import org.springframework.data.mongodb.core.mapping.Field;
BsonSerializer.java (git://github.com/jillesvangurp/jsonj.git) Java · 85 lines
Command.java (git://github.com/bguerout/jongo.git) Java · 96 lines
GridFSFindPublisherImpl.java (git://github.com/mongodb/mongo-java-driver.git) Java · 96 lines
1 /*
2 * Copyright 2008-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.reactivestreams.client.internal;
19 import com.mongodb.client.gridfs.model.GridFSFile;
20 import com.mongodb.client.model.Collation;
21 import com.mongodb.internal.async.client.gridfs.AsyncGridFSFindIterable;
22 import com.mongodb.reactivestreams.client.gridfs.GridFSFindPublisher;
23 import org.bson.conversions.Bson;
24 import org.reactivestreams.Publisher;
TestInternalConnection.java (git://github.com/mongodb/mongo-java-driver.git) Java · 190 lines
1 /*
2 * Copyright (c) 2008-2014 MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.connection;
19 import com.mongodb.MongoException;
20 import com.mongodb.async.SingleResultCallback;
21 import org.bson.ByteBuf;
22 import org.bson.ByteBufNIO;
GridFSDBFile.java (git://github.com/mongodb/mongo-java-driver.git) Java · 202 lines
1 /*
2 * Copyright 2008-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.gridfs;
19 import com.mongodb.BasicDBObject;
20 import com.mongodb.DBObject;
21 import com.mongodb.MongoException;
34 * </ul>
35 *
36 * @mongodb.driver.manual core/gridfs/ GridFS
37 */
38 public class GridFSDBFile extends GridFSFile {
MessageHeader.java (git://github.com/suguru/mongo-java-async-driver.git) Java · 120 lines
ExecutableUpdateOperation.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 291 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.core;
18 import java.util.Optional;
20 import org.springframework.data.mongodb.core.aggregation.AggregationUpdate;
21 import org.springframework.data.mongodb.core.query.CriteriaDefinition;
22 import org.springframework.data.mongodb.core.query.Query;
23 import org.springframework.data.mongodb.core.query.Update;
24 import org.springframework.data.mongodb.core.query.UpdateDefinition;
25 import org.springframework.lang.Nullable;
MongoDBTask.java (https://bitbucket.org/keypointt/foreveryoung.git) Java · 221 lines
1 package com.foreveryoung.mongodb;
3 import java.util.ArrayList;
16 import com.foreveryoung.models.User;
17 import com.foreveryoung.models.notices.Suggestion;
18 import com.foreveryoung.mongodb.RESTClient.RequestMethod;
19 import com.google.gson.JsonArray;
20 import com.google.gson.JsonParser;
22 /**
23 * DB Operations class runs common operations on the mongoDB web server.
24 *
25 * @author jeremywallace
26 *
27 */
28 public class MongoDBTask {
30 private final String DB_URI = "api.mongolab.com/api/1/databases/foreveryoung/collections/";
ChildCodecRegistry.java (git://github.com/mongodb/mongo-java-driver.git) Java · 101 lines
MongoInputSplit.java (git://github.com/mongodb/mongo-hadoop.git) Java · 130 lines
16 */
18 package com.mongodb.hadoop.mapred.input;
20 import com.mongodb.*;
21 import com.mongodb.hadoop.util.*;
22 import com.mongodb.util.*;
43 }
45 public MongoInputSplit( com.mongodb.hadoop.input.MongoInputSplit split ){
46 this(split.getMongoURI(), split.getQuerySpec(), split.getFieldSpec(), split.getSortSpec(), split.getLimit(),
47 split.getSkip());
SimpleMongoClientDatabaseFactoryUnitTests.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 110 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.core;
18 import static org.assertj.core.api.Assertions.*;
29 import org.springframework.aop.framework.AopProxyUtils;
30 import org.springframework.data.mongodb.MongoDatabaseFactory;
31 import org.springframework.test.util.ReflectionTestUtils;
33 import com.mongodb.ConnectionString;
34 import com.mongodb.client.ClientSession;
35 import com.mongodb.client.MongoClient;
36 import com.mongodb.client.MongoDatabase;
MappingAsyncBatchCursor.java (https://github.com/mongodb/mongo-java-driver.git) Java · 89 lines
MongoCredentialTest.java (git://github.com/mongodb/mongo-java-driver.git) Java · 165 lines
1 /*
2 * Copyright (c) 2008-2014 MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb;
19 import com.mongodb.util.TestCase;
36 MongoCredential credentials;
38 final String mechanism = MongoCredential.MONGODB_CR_MECHANISM;
39 final String userName = "user";
40 final String database = "test";
110 // then
111 assertEquals("mongodb", credential.getMechanismProperty(firstKey, "mongodb"));
112 }
MongoFixture.java (git://github.com/mongodb/mongo-java-driver.git) Java · 221 lines
1 /*
2 * Copyright 2008-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.reactivestreams.client;
19 import com.mongodb.ClusterFixture;
20 import com.mongodb.MongoClientSettings;
21 import com.mongodb.MongoCommandException;
22 import com.mongodb.MongoException;
23 import com.mongodb.MongoNamespace;
ClusterBinding.java (git://github.com/mongodb/mongo-java-driver.git) Java · 190 lines
1 /*
2 * Copyright 2008-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.internal.binding;
19 import com.mongodb.ReadConcern;
20 import com.mongodb.ReadPreference;
21 import com.mongodb.RequestContext;
22 import com.mongodb.ServerAddress;
23 import com.mongodb.ServerApi;
WorldDevIndicatorDataLoader.java (git://github.com/mongodb/mongo-hadoop.git) Java · 140 lines
CriteriaContainerImpl.java (http://morphia.googlecode.com/svn/trunk/) Java · 110 lines
ListCollectionsPublisherImpl.java (git://github.com/mongodb/mongo-java-driver.git) Java · 66 lines
1 /*
2 * Copyright 2008-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.reactivestreams.client.internal;
19 import com.mongodb.ReadConcern;
20 import com.mongodb.internal.async.AsyncBatchCursor;
21 import com.mongodb.internal.operation.AsyncReadOperation;
22 import com.mongodb.lang.Nullable;
23 import com.mongodb.reactivestreams.client.ClientSession;
Address.java (https://bitbucket.org/jochristo/dumpster-springboot-2.0.git) Java · 139 lines
RadioPlayerUploadHealthProbeTest.java (https://github.com/atlasapi/atlas-feeds.git) Java · 132 lines
AuditMaoImpl.java (https://bitbucket.org/piyushgd10/bhumi.git) Java · 62 lines
12 import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.beans.factory.annotation.Qualifier;
14 import org.springframework.data.mongodb.core.MongoOperations;
15 import org.springframework.data.mongodb.core.query.Criteria;
16 import org.springframework.data.mongodb.core.query.Query;
17 import org.springframework.stereotype.Repository;
UserNotificationVO.java (https://bitbucket.org/piyushgd10/bhumi.git) Java · 115 lines
12 import org.springframework.data.annotation.Id;
13 import org.springframework.data.mongodb.core.index.CompoundIndex;
14 import org.springframework.data.mongodb.core.index.CompoundIndexes;
15 import org.springframework.data.mongodb.core.mapping.Document;
17 import com.uniware.core.vo.UserNotificationTypeVO.NotificationType;
ListCollectionsIterableImpl.java (git://github.com/mongodb/mongo-java-driver.git) Java · 127 lines
1 /*
2 * Copyright 2015 MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.async.client;
19 import com.mongodb.Block;
20 import com.mongodb.Function;
21 import com.mongodb.ReadPreference;
22 import com.mongodb.async.AsyncBatchCursor;
23 import com.mongodb.async.SingleResultCallback;
MongoDbVerifierExtensionTest.java (https://github.com/apache/camel.git) Java · 133 lines
15 * limitations under the License.
16 */
17 package org.apache.camel.component.mongodb.verifier;
19 import java.util.HashMap;
22 import org.apache.camel.Component;
23 import org.apache.camel.component.extension.ComponentVerifierExtension;
24 import org.apache.camel.component.mongodb.AbstractMongoDbTest;
25 import org.junit.jupiter.api.BeforeEach;
26 import org.junit.jupiter.api.Test;
29 import static org.junit.jupiter.api.Assertions.assertTrue;
31 public class MongoDbVerifierExtensionTest extends AbstractMongoDbTest {
32 // We simulate the presence of an authenticated user
33 @BeforeEach
MongodbSeed.java (git://github.com/Graylog2/graylog2-server.git) Java · 106 lines
15 * along with Graylog. If not, see <http://www.gnu.org/licenses/>.
16 */
17 package integration.util.mongodb;
19 import com.mongodb.BasicDBObject;
20 import com.mongodb.DB;
21 import com.mongodb.DBCollection;
22 import com.mongodb.DBObject;
23 import com.mongodb.MongoClient;
32 import java.util.Map;
34 public class MongodbSeed {
35 private final MongoClient mongoClient;
36 private final DB mongoDatabase;
ClientAcceptanceTest.java (git://github.com/mongodb/mongo-java-driver.git) Java · 107 lines
1 /*
2 * Copyright (c) 2015 MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.acceptancetest.core;
19 import com.mongodb.client.DatabaseTestCase;
20 import com.mongodb.client.MongoDatabase;
21 import org.bson.Document;
22 import org.hamcrest.BaseMatcher;
ExecutableRemoveOperation.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 142 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.core;
18 import java.util.List;
20 import org.springframework.data.mongodb.core.query.CriteriaDefinition;
21 import org.springframework.data.mongodb.core.query.Query;
23 import com.mongodb.client.result.DeleteResult;
25 /**
26 * {@link ExecutableRemoveOperation} allows creation and execution of MongoDB remove / findAndRemove operations in a
27 * fluent API style. <br />
28 * The starting {@literal domainType} is used for mapping the {@link Query} provided via {@code matching} into the
CountQueryUnitTests.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 163 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.core;
18 import static org.mockito.Mockito.*;
19 import static org.springframework.data.mongodb.core.query.Criteria.*;
20 import static org.springframework.data.mongodb.core.query.Query.*;
21 import static org.springframework.data.mongodb.test.util.Assertions.*;
23 import org.junit.jupiter.api.BeforeEach;
26 import org.springframework.data.geo.Point;
27 import org.springframework.data.mongodb.MongoDatabaseFactory;
28 import org.springframework.data.mongodb.core.convert.DefaultDbRefResolver;
LiteralNode.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 94 lines
TestConnection.java (git://github.com/mongodb/mongo-java-driver.git) Java · 263 lines
1 /*
2 * Copyright (c) 2008-2015 MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.connection;
19 import com.mongodb.MongoNamespace;
20 import com.mongodb.WriteConcern;
21 import com.mongodb.WriteConcernResult;
22 import com.mongodb.async.SingleResultCallback;
23 import com.mongodb.bulk.BulkWriteResult;
BucketOperationUnitTests.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 209 lines
WriteConcernProseTest.java (git://github.com/mongodb/mongo-java-driver.git) Java · 88 lines
1 /*
2 * Copyright 2008-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.client;
19 import com.mongodb.MongoWriteConcernException;
26 import org.junit.Test;
28 import static com.mongodb.ClusterFixture.isDiscoverableReplicaSet;
29 import static com.mongodb.ClusterFixture.serverVersionAtLeast;
35 import static org.junit.Assume.assumeTrue;
37 // See https://github.com/mongodb/specifications/tree/master/source/change-streams/tests/README.rst#prose-tests
38 public class WriteConcernProseTest extends DatabaseTestCase {
39 private BsonDocument failPointDocument;
InsertOptions.java (git://github.com/mongodb/mongo-java-driver.git) Java · 121 lines
1 /*
2 * Copyright 2008-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb;
19 import com.mongodb.lang.Nullable;
21 /**
22 * Options related to insertion of documents into MongoDB. The setter methods return {@code this} so that a chaining style can be used.
23 *
24 * @since 2.13
25 * @mongodb.driver.manual tutorial/insert-documents/ Insert Tutorial
26 */
27 public final class InsertOptions {
MongoFactoryBean.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 193 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.core;
18 import java.util.ArrayList;
26 import org.springframework.dao.DataAccessException;
27 import org.springframework.dao.support.PersistenceExceptionTranslator;
28 import org.springframework.data.mongodb.CannotGetMongoDbConnectionException;
29 import org.springframework.util.StringUtils;
31 import com.mongodb.Mongo;
32 import com.mongodb.MongoOptions;
33 import com.mongodb.ServerAddress;
34 import com.mongodb.WriteConcern;
DropUserOperation.java (git://github.com/mongodb/mongo-java-driver.git) Java · 148 lines
1 /*
2 * Copyright (c) 2008-2016 MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.operation;
19 import com.mongodb.MongoCommandException;
20 import com.mongodb.MongoNamespace;
21 import com.mongodb.WriteConcern;
22 import com.mongodb.WriteConcernResult;
23 import com.mongodb.async.SingleResultCallback;
Client.java (https://gitlab.com/rgwch/solview.git) Java · 104 lines
MongoUtils.java (https://gitlab.com/icarusalways/jackrabbit-oak.git) Java · 85 lines
DefaultDocumentToObjectConverterTest.java (https://github.com/equake/monjo.git) Java · 164 lines
17 import org.monjo.example.SimplePOJO;
18 import org.monjo.example.SimplePOJOWithStringId;
19 import org.monjo.test.util.MongoDBTest;
21 import com.mongodb.BasicDBObject;
22 import com.mongodb.DBObject;
24 import contrib.org.hibernate.cfg.DefaultNamingStrategy;
26 public class DefaultDocumentToObjectConverterTest extends MongoDBTest {
28 @Before
29 public void setUp() throws Exception {
30 MongoDBTest.getMonjoCollection().drop();
31 }
TestStandalone.java (git://github.com/mongodb/mongo-hadoop.git) Java · 120 lines
1 package com.mongodb.hadoop;
3 import com.mongodb.MongoClientURI;
4 import com.mongodb.hadoop.examples.treasury.TreasuryYieldXMLConfig;
5 import com.mongodb.hadoop.mapred.output.MongoOutputCommitter;
6 import com.mongodb.hadoop.splitter.MultiMongoCollectionSplitter;
7 import com.mongodb.hadoop.splitter.SingleMongoSplitter;
8 import com.mongodb.hadoop.testutils.MapReduceJob;
9 import com.mongodb.hadoop.util.MongoClientURIBuilder;
17 import org.junit.Test;
19 import static com.mongodb.hadoop.splitter.MultiMongoCollectionSplitter.MULTI_COLLECTION_CONF_KEY;
20 import static com.mongodb.hadoop.util.MongoConfigUtil.INPUT_NOTIMEOUT;
GridFsTest.java (git://github.com/bguerout/jongo.git) Java · 90 lines
SimpleMongoClientDbFactory.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 74 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.core;
18 import com.mongodb.ConnectionString;
19 import com.mongodb.client.MongoClient;
20 import com.mongodb.client.MongoClients;
21 import com.mongodb.client.MongoDatabase;
23 /**
36 * @param connectionString connection coordinates for a database connection. Must contain a database name and must not
37 * be {@literal null} or empty.
38 * @see <a href="https://docs.mongodb.com/manual/reference/connection-string/">MongoDB Connection String reference</a>
39 */
40 public SimpleMongoClientDbFactory(String connectionString) {
IndexResolver.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 72 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.core.index;
18 import org.springframework.data.mapping.context.MappingContext;
19 import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
20 import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
21 import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
22 import org.springframework.data.util.ClassTypeInformation;
23 import org.springframework.data.util.TypeInformation;
ReactiveAggregationOperationSupport.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 129 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.core;
18 import reactor.core.publisher.Flux;
20 import org.springframework.data.mongodb.core.aggregation.Aggregation;
21 import org.springframework.data.mongodb.core.aggregation.TypedAggregation;
49 /*
50 * (non-Javadoc)
51 * @see org.springframework.data.mongodb.core.ReactiveAggregationOperation#aggregateAndReturn(java.lang.Class)
52 */
53 @Override
90 /*
91 * (non-Javadoc)
92 * @see org.springframework.data.mongodb.core.ReactiveAggregationOperation.AggregationOperationWithAggregation#by(org.springframework.data.mongodb.core.Aggregation)
93 */
94 @Override
WebConfiguration.java (git://github.com/SpringSource/cloudfoundry-samples.git) Java · 49 lines
5 import org.springframework.context.annotation.Configuration;
6 import org.springframework.context.annotation.Import;
7 import org.springframework.data.mongodb.examples.custsvc.web.CloudFoundryEnvironmentHandlerInterceptor;
8 import org.springframework.web.servlet.config.annotation.*;
9 import org.springframework.web.servlet.view.InternalResourceViewResolver;
12 @EnableWebMvc
13 @Import(ServicesConfiguration.class)
14 @ComponentScan("org.springframework.data.mongodb.examples.custsvc.web")
15 public class WebConfiguration extends WebMvcConfigurerAdapter {
ReflectionTest.java
(git://github.com/mongodb/mongo-java-driver.git)
Java · 140 lines
✨ Summary
This Java code tests MongoDB’s reflection-based object mapping functionality using JUnit tests. It creates classes that extend ReflectionDBObject
and tests their serialization, deserialization, and interaction with MongoDB’s DBCollection. The tests verify that objects are correctly mapped to and from MongoDB documents, including nested objects and fields with different data types.
This Java code tests MongoDB’s reflection-based object mapping functionality using JUnit tests. It creates classes that extend ReflectionDBObject
and tests their serialization, deserialization, and interaction with MongoDB’s DBCollection. The tests verify that objects are correctly mapped to and from MongoDB documents, including nested objects and fields with different data types.
FindAndModifyHelper.java (git://github.com/mongodb/mongo-java-driver.git) Java · 66 lines
1 /*
2 * Copyright (c) 2008-2014 MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.operation;
19 import com.mongodb.MongoWriteConcernException;
20 import com.mongodb.ServerAddress;
21 import com.mongodb.WriteConcernResult;
22 import com.mongodb.bulk.WriteConcernError;
23 import com.mongodb.operation.CommandOperationHelper.CommandTransformer;
CursorIterator.java (https://github.com/velna/jmongo.git) Java · 218 lines
Compressor.java (git://github.com/mongodb/mongo-java-driver.git) Java · 134 lines
CommandResult.java (git://github.com/mongodb/mongo-java-driver.git) Java · 98 lines
1 /*
2 * Copyright (c) 2008-2014 MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb;
19 import org.bson.BsonDocument;
21 import static com.mongodb.DBObjects.toDBObject;
22 import static com.mongodb.assertions.Assertions.notNull;
25 * A simple wrapper to hold the result of a command. All the fields from the response document have been added to this result.
26 *
27 * @mongodb.driver.manual reference/command/ Database Commands
28 */
29 public class CommandResult extends BasicDBObject {
SortOperation.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 89 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.core.aggregation;
18 import org.bson.Document;
34 * @author Mark Paluch
35 * @since 1.3
36 * @see <a href="https://docs.mongodb.com/manual/reference/operator/aggregation/sort/">MongoDB Aggregation Framework:
37 * $sort</a>
38 */
62 /*
63 * (non-Javadoc)
64 * @see org.springframework.data.mongodb.core.aggregation.AggregationOperation#toDocument(org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
65 */
66 @Override
UnwrapAndReadDbObjectCallbackUnitTests.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 96 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.core;
18 import static org.hamcrest.CoreMatchers.*;
24 import org.mockito.Mock;
25 import org.mockito.runners.MockitoJUnitRunner;
26 import org.springframework.data.mongodb.MongoDbFactory;
27 import org.springframework.data.mongodb.core.MongoTemplate.UnwrapAndReadDbObjectCallback;
28 import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
29 import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
31 import com.mongodb.BasicDBObject;
33 /**
GraphSONTool.java (git://github.com/mongodb/mongo-snippets.git) Java · 124 lines
1 package org.mongodb.graph;
3 import java.io.File;
11 import com.beust.jcommander.Parameter;
12 import com.beust.jcommander.Parameters;
13 import com.mongodb.DB;
14 import com.mongodb.MongoClient;
19 static class MainArgs {
21 private static final String DEFAULT_MONGODB_ENDPOINT = "mongodb://localhost:27017/";
22 @Parameter(names = "--dburi", description = "MongoDB URI for target database")
102 // Create the graph listener for the mongodb database
103 MongoDBListener listener = new MongoDBListener(
104 database, importCmd.drop, importCmd.duplicateMode,
105 mainArgs.vertexCollectionName, mainArgs.edgeCollectionName);
TableDeleteCommand.java (https://repo.or.cz/Tadpole.git) Java · 96 lines
9 * hangum - initial API and implementation
10 ******************************************************************************/
11 package com.hangum.tadpole.mongodb.erd.core.command;
13 import java.util.ArrayList;
18 import org.eclipse.gef.commands.Command;
20 import com.hangum.tadpole.mongodb.model.DB;
21 import com.hangum.tadpole.mongodb.model.Relation;
22 import com.hangum.tadpole.mongodb.model.RelationKind;
23 import com.hangum.tadpole.mongodb.model.Table;
MongoDbShardKeySetting.java (git://github.com/WindowsAzure/azure-sdk-for-java.git) Java · 70 lines
14 /**
15 * Describes a MongoDB shard key.
16 */
17 public class MongoDbShardKeySetting {
20 */
21 @JsonProperty(value = "fields", required = true)
22 private List<MongoDbShardKeyField> fields;
24 /**
43 * @return the MongoDbShardKeySetting object itself.
44 */
45 public MongoDbShardKeySetting withFields(List<MongoDbShardKeyField> fields) {
46 this.fields = fields;
47 return this;
WriteResult.java (git://github.com/mongodb/mongo-java-driver.git) Java · 134 lines
1 /*
2 * Copyright (c) 2008-2014 MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb;
66 *
67 * @return true if the write was acknowledged
68 * @see com.mongodb.WriteConcern#UNACKNOWLEDGED
69 * @since 3.0
70 */
87 /**
88 * Gets the _id value of an upserted document that resulted from this write. Note that for MongoDB servers prior to version 2.6,
89 * this method will return null unless the _id of the upserted document was of type ObjectId.
90 *
WriteConcernDocumentTest.java (git://github.com/mongodb/mongo-java-driver.git) Java · 101 lines
1 /*
2 * Copyright 2008-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb;
19 import junit.framework.TestCase;
37 import java.util.concurrent.TimeUnit;
39 // See https://github.com/mongodb/specifications/tree/master/source/read-write-concern/tests/connection-string
40 @RunWith(Parameterized.class)
41 public class WriteConcernDocumentTest extends TestCase {
QuickTourAdmin.java (git://github.com/mongodb/mongo-java-driver.git) Java · 117 lines
1 /*
2 * Copyright 2015 MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
17 package tour;
19 import com.mongodb.MongoClient;
20 import com.mongodb.MongoClientURI;
21 import com.mongodb.client.MongoCollection;
22 import com.mongodb.client.MongoDatabase;
23 import com.mongodb.client.model.CreateCollectionOptions;
24 import com.mongodb.client.model.Indexes;
25 import com.mongodb.client.model.TextSearchOptions;
26 import org.bson.Document;
27 import org.bson.conversions.Bson;
AsyncClusterBinding.java (git://github.com/mongodb/mongo-java-driver.git) Java · 118 lines
1 /*
2 * Copyright (c) 2008-2014 MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.binding;
19 import com.mongodb.ReadPreference;
20 import com.mongodb.async.SingleResultCallback;
21 import com.mongodb.connection.AsyncConnection;
22 import com.mongodb.connection.Cluster;
23 import com.mongodb.connection.Server;
PlayJongo.java (https://github.com/alexanderjarvis/play-jongo.git) Java · 122 lines
DefaultClusterableServerFactory.java (git://github.com/mongodb/mongo-java-driver.git) Java · 61 lines
MongoContentGroupResolver.java (https://github.com/atlasapi/atlas-persistence.git) Java · 71 lines
4 import org.atlasapi.persistence.content.ResolvedContent.ResolvedContentBuilder;
5 import com.metabroadcast.common.persistence.mongo.DatabasedMongo;
6 import com.mongodb.DBCollection;
7 import com.mongodb.DBObject;
12 import org.atlasapi.persistence.media.entity.IdentifiedTranslator;
13 import static com.metabroadcast.common.persistence.mongo.MongoBuilders.where;
14 import com.mongodb.DBCursor;
15 import java.util.HashSet;
16 import java.util.Set;
OddJobRandomTaskModule.java (https://github.com/atlasapi/atlas.git) Java · 70 lines
LazyDBList.java (git://github.com/mongodb/mongo-java-driver.git) Java · 59 lines
GridFsOperations.java (https://gitlab.com/javajamesb08/spring-data-mongodb.git) Java · 162 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.gridfs;
18 import java.io.InputStream;
21 import org.springframework.core.io.support.ResourcePatternResolver;
22 import org.springframework.data.domain.Sort;
23 import org.springframework.data.mongodb.core.query.Query;
25 import com.mongodb.DBObject;
26 import com.mongodb.gridfs.GridFSDBFile;
27 import com.mongodb.gridfs.GridFSFile;
29 /**
30 * Collection of operations to store and read files from MongoDB GridFS.
31 *
32 * @author Oliver Gierke
MapReduceIterable.java (https://github.com/mongodb/mongo-java-driver.git) Java · 200 lines
1 /*
2 * Copyright 2008-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.async.client;
20 import com.mongodb.async.SingleResultCallback;
21 import com.mongodb.client.model.Collation;
22 import com.mongodb.client.model.MapReduceAction;
23 import com.mongodb.lang.Nullable;
OperatorNode.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 161 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.core.spel;
18 import java.util.Collections;
92 /*
93 * (non-Javadoc)
94 * @see org.springframework.data.mongodb.core.spel.ExpressionNode#isMathematicalOperation()
95 */
96 @Override
101 /*
102 * (non-Javadoc)
103 * @see org.springframework.data.mongodb.core.spel.ExpressionNode#isConjunctionOperator()
104 */
105 @Override
UpdateOperation.java (git://github.com/mongodb/mongo-java-driver.git) Java · 122 lines
1 /*
2 * Copyright (c) 2008-2014 MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.operation;
19 import com.mongodb.MongoNamespace;
20 import com.mongodb.WriteConcern;
21 import com.mongodb.WriteConcernResult;
22 import com.mongodb.async.SingleResultCallback;
23 import com.mongodb.bulk.BulkWriteResult;
ClientSessionOptions.java (git://github.com/mongodb/mongo-java-driver.git) Java · 222 lines
1 /*
2 * Copyright 2008-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb;
19 import com.mongodb.annotations.Immutable;
20 import com.mongodb.annotations.NotThreadSafe;
21 import com.mongodb.lang.Nullable;
22 import com.mongodb.session.ClientSession;
24 import java.util.Objects;
LatencyMinimizingServerSelector.java (git://github.com/mongodb/mongo-java-driver.git) Java · 104 lines
1 /*
2 * Copyright (c) 2008-2014 MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.selector;
19 import com.mongodb.connection.ClusterDescription;
20 import com.mongodb.connection.ServerDescription;
22 import java.util.ArrayList;
24 import java.util.concurrent.TimeUnit;
26 import static com.mongodb.connection.ClusterConnectionMode.MULTIPLE;
27 import static java.util.concurrent.TimeUnit.MILLISECONDS;
28 import static java.util.concurrent.TimeUnit.NANOSECONDS;
UnsetOperationUnitTests.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 115 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.core.aggregation;
18 import static org.assertj.core.api.Assertions.*;
25 import org.junit.jupiter.api.Test;
26 import org.springframework.data.annotation.Id;
27 import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
28 import org.springframework.data.mongodb.core.convert.NoOpDbRefResolver;
29 import org.springframework.data.mongodb.core.convert.QueryMapper;
30 import org.springframework.data.mongodb.core.mapping.Field;
31 import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
32 import org.springframework.lang.Nullable;
ReactiveAggregationOperation.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 101 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.core;
18 import reactor.core.publisher.Flux;
20 import org.springframework.data.mongodb.core.aggregation.Aggregation;
22 /**
23 * {@link ReactiveAggregationOperation} allows creation and execution of reactive MongoDB aggregation operations in a
24 * fluent API style. <br />
25 * The starting {@literal domainType} is used for mapping the {@link Aggregation} provided via {@code by} into the
InternalStreamConnectionInitializer.java (git://github.com/mongodb/mongo-java-driver.git) Java · 207 lines
1 /*
2 * Copyright (c) 2008-2014 MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.connection;
19 import com.mongodb.async.SingleResultCallback;
24 import java.util.concurrent.atomic.AtomicInteger;
26 import static com.mongodb.assertions.Assertions.notNull;
27 import static com.mongodb.connection.CommandHelper.executeCommand;
28 import static com.mongodb.connection.CommandHelper.executeCommandAsync;
29 import static com.mongodb.connection.CommandHelper.executeCommandWithoutCheckingForFailure;
ExempleProjection.java (https://gitlab.com/Dani-07/DAM-2n-POO-i-acces-a-dades.git) Java · 72 lines
1 package mongodb;
3 import static com.mongodb.client.model.Filters.and;
4 import static com.mongodb.client.model.Filters.eq;
5 import static com.mongodb.client.model.Filters.gt;
10 import org.bson.conversions.Bson;
12 import com.mongodb.Block;
13 import com.mongodb.MongoClient;
14 import com.mongodb.client.MongoCollection;
15 import com.mongodb.client.MongoDatabase;
16 import com.mongodb.client.model.Projections;
18 public class ExempleProjection {
MongodbConnectorEmbeddedDebeziumConfigurationTest.java (https://github.com/apache/camel.git) Java · 91 lines
21 import io.debezium.connector.mongodb.MongoDbConnector;
22 import io.debezium.connector.mongodb.MongoDbConnectorConfig;
23 import io.debezium.embedded.EmbeddedEngine;
24 import org.apache.camel.component.debezium.DebeziumConstants;
33 @Test
34 void testIfCreatesConfig() {
35 final MongoDbConnectorEmbeddedDebeziumConfiguration configuration = new MongoDbConnectorEmbeddedDebeziumConfiguration();
36 configuration.setName("test_config");
37 configuration.setMongodbUser("test_user");
50 @Test
51 void testIfValidatesConfigurationCorrectly() {
52 final MongoDbConnectorEmbeddedDebeziumConfiguration configuration = new MongoDbConnectorEmbeddedDebeziumConfiguration();
54 configuration.setName("test_config");
68 @Test
69 void testValidateConfigurationsForAllRequiredFields() {
70 final MongoDbConnectorEmbeddedDebeziumConfiguration configuration = new MongoDbConnectorEmbeddedDebeziumConfiguration();
71 configuration.setName("test_config");
72 configuration.setMongodbUser("test_db");
PageDao.java (https://bitbucket.org/ifloor/kafkaboot.git) Java · 46 lines
3 import br.com.igormaldonado.springbootexample.model.Page;
4 import com.mongodb.bulk.BulkWriteResult;
5 import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.data.geo.Circle;
7 import org.springframework.data.geo.Distance;
8 import org.springframework.data.geo.Point;
9 import org.springframework.data.mongodb.core.BulkOperations;
10 import org.springframework.data.mongodb.core.MongoTemplate;
11 import org.springframework.data.mongodb.core.query.Criteria;
12 import org.springframework.data.mongodb.core.query.Query;
SaleOrderReconciliation.java (https://bitbucket.org/piyushgd10/bhumi.git) Java · 270 lines
Java8SniSslHelper.java (https://github.com/mongodb/mongo-java-driver.git) Java · 50 lines
1 /*
2 * Copyright 2008-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.internal.connection;
19 import javax.net.ssl.SNIHostName;
41 sslParameters.setServerNames(singletonList(sniHostName));
42 } catch (IllegalArgumentException e) {
43 // ignore because SNIHostName will throw this for some legit host names for connecting to MongoDB, e.g an IPV6 literal
44 }
45 }
MongoBridge.java (https://github.com/5v3n/graylog2-server.git) Java · 172 lines
21 package org.graylog2.database;
23 import com.mongodb.DBCollection;
24 import com.mongodb.BasicDBObject;
25 import com.mongodb.BasicDBObjectBuilder;
27 import org.graylog2.Log;
36 * MongoBridge.java: Apr 13, 2010 9:13:03 PM
37 *
38 * Simple mapping methods to MongoDB.
39 *
40 * @author: Lennart Koopmann <lennart@socketfeed.com>
44 /**
45 * The standard MongoDB port.
46 */
47 public static final int STANDARD_PORT = 27017;
DBObjectAccessor.java (git://github.com/SpringSource/spring-data-mongodb.git) Java · 124 lines
14 * limitations under the License.
15 */
16 package org.springframework.data.mongodb.core.convert;
18 import java.util.Arrays;
20 import java.util.Map;
22 import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
23 import org.springframework.util.Assert;
25 import com.mongodb.BasicDBObject;
26 import com.mongodb.DBObject;
MongoDBCollectionGetPropertiesResource.java (git://github.com/WindowsAzure/azure-sdk-for-java.git) Java · 144 lines
15 /**
16 * The MongoDBCollectionGetPropertiesResource model.
17 */
18 public class MongoDBCollectionGetPropertiesResource {
19 /**
20 * Name of the Cosmos DB MongoDB collection.
21 */
22 @JsonProperty(value = "id", required = true)
57 /**
58 * Get name of the Cosmos DB MongoDB collection.
59 *
60 * @return the id value
InrixData.java (https://bitbucket.org/rbyna/timeli-middleware.git) Java · 125 lines
CreateIndexCommitQuorum.java (git://github.com/mongodb/mongo-java-driver.git) Java · 163 lines
1 /*
2 * Copyright 2008-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb;
19 import org.bson.BsonInt32;
21 import org.bson.BsonValue;
23 import static com.mongodb.assertions.Assertions.notNull;
25 /**
27 * complete the index builds successfully before the primary marks the indexes as ready.
28 *
29 * @mongodb.driver.manual reference/command/createIndexes/ Create indexes
30 * @mongodb.server.release 4.4
CAPI.java (https://github.com/mongodb/mongo.git) Java · 168 lines
2 /**
3 * Copyright (C) 2018-present MongoDB, Inc.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the Server Side Public License, version 1,
7 * as published by MongoDB, Inc.
8 *
9 * This program is distributed in the hope that it will be useful,
14 * You should have received a copy of the Server Side Public License
15 * along with this program. If not, see
16 * <http://www.mongodb.com/licensing/server-side-public-license>.
17 *
18 * As a special exception, the copyright holders give permission to link the
DBCollectionObjectFactory.java (git://github.com/mongodb/mongo-java-driver.git) Java · 96 lines
BSONFileInputFormat.java (git://github.com/mongodb/mongo-hadoop.git) Java · 133 lines
15 */
17 package com.mongodb.hadoop.mapred;
19 import com.mongodb.hadoop.io.BSONWritable;
20 import com.mongodb.hadoop.mapred.input.BSONFileRecordReader;
21 import com.mongodb.hadoop.mapred.input.BSONFileSplit;
22 import com.mongodb.hadoop.splitter.BSONSplitter;
23 import com.mongodb.hadoop.util.MongoConfigUtil;
39 import java.util.List;
41 import static com.mongodb.hadoop.splitter.BSONSplitter.getSplitsFilePath;
42 import static java.lang.String.format;
CommandReadOperation.java (git://github.com/mongodb/mongo-java-driver.git) Java · 75 lines
1 /*
2 * Copyright 2008-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.internal.operation;
19 import com.mongodb.internal.async.SingleResultCallback;
20 import com.mongodb.connection.ConnectionDescription;
21 import com.mongodb.connection.ServerDescription;
22 import com.mongodb.internal.binding.AsyncReadBinding;
23 import com.mongodb.internal.binding.ReadBinding;
GridFSDownloadPublisherImpl.java (git://github.com/mongodb/mongo-java-driver.git) Java · 295 lines
1 /*
2 * Copyright 2008-present MongoDB, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
15 */
17 package com.mongodb.reactivestreams.client.internal;
19 import com.mongodb.Block;
20 import com.mongodb.client.gridfs.model.GridFSFile;
21 import com.mongodb.internal.async.SingleResultCallback;
22 import com.mongodb.internal.async.client.gridfs.AsyncGridFSDownloadStream;
23 import com.mongodb.reactivestreams.client.gridfs.GridFSDownloadPublisher;
ExportSubscriber.java (https://bitbucket.org/piyushgd10/bhumi.git) Java · 75 lines
TreasuryYieldXMLConfigV2.java (https://gitlab.com/mkgobaco/mongo-hadoop.git) Java · 107 lines
14 * limitations under the License.
15 */
16 package com.mongodb.hadoop.examples.treasury;
18 import com.mongodb.hadoop.io.BSONWritable;
19 import com.mongodb.hadoop.mapred.MongoInputFormat;
20 import com.mongodb.hadoop.mapred.MongoOutputFormat;
21 import com.mongodb.hadoop.util.MongoConfigUtil;
22 import org.apache.commons.logging.Log;
23 import org.apache.commons.logging.LogFactory;