public abstract class BasicAcceptanceTestCases extends ServerTestDriverSupport
These are not meant to be exhaustive tests of the driver but instead attempt to demonstrate that interactions with the MongoDB processes work. These tests are expected to verify that the format and structure of the messages the driver generates are acceptable to the MongoDB servers.
Modifier and Type | Class and Description |
---|---|
static class |
BasicAcceptanceTestCases.DocumentCallback
DocumentCallback provides a simple callback for testing streaming finds.
|
Modifier and Type | Field and Description |
---|---|
static String |
GEO_TEST_COLLECTION_NAME
The name of the test collection to use.
|
static String |
GRIDFS_COLLECTION_ROOT_NAME
The name of the test Grid FS chunks collection to use.
|
static int |
LARGE_COLLECTION_COUNT
One million - used when we want a large collection of document.
|
protected MongoCollection |
myCollection
The default collection for the test.
|
protected MongoClientConfiguration |
myConfig
The configuration for the test.
|
protected MongoDatabase |
myDb
The default database to use for the test.
|
protected MongoCollection |
myGeoCollection
The Geospatial collection using a
2d index for the test. |
protected MongoCollection |
myGeoSphereCollection
The Geospatial collection using a
2dsphere index for the test. |
protected MongoClient |
myMongo
The connection to MongoDB for the test.
|
protected Random |
myRandom
A source of random for the tests.
|
protected static int |
ourUniqueId
A unique value to add to each collection name to ensure test isolation.
|
static int |
SMALL_COLLECTION_COUNT
One hundred - used when we only need a small collection.
|
static String |
TEST_COLLECTION_NAME
The name of the test collection to use.
|
static String |
TEST_DB_NAME
The name of the test database to use.
|
ADMIN_USER_NAME, DEFAULT_PORT, ourClusterTestSupport, PASSWORD, USER_DB, USER_NAME
Constructor and Description |
---|
BasicAcceptanceTestCases() |
repairReplicaSet, startAuthenticated, startReplicaSet, startSharded, startShardedReplicaSets, startStandAlone, stopReplicaSet, stopSharded, stopShardedReplicaSets, stopStandAlone
public static final String GEO_TEST_COLLECTION_NAME
public static final String GRIDFS_COLLECTION_ROOT_NAME
public static final int LARGE_COLLECTION_COUNT
public static final int SMALL_COLLECTION_COUNT
public static final String TEST_COLLECTION_NAME
public static final String TEST_DB_NAME
protected static int ourUniqueId
protected MongoCollection myCollection
protected MongoClientConfiguration myConfig
protected MongoDatabase myDb
protected MongoCollection myGeoCollection
2d
index for the test.protected MongoCollection myGeoSphereCollection
2dsphere
index for the test.protected MongoClient myMongo
protected Random myRandom
protected static void buildLargeCollection()
protected static InetSocketAddress createAddress()
InetSocketAddress
for the MongoDB server.protected static void disableBalancer()
protected static MongoCollection largeCollection(MongoClient mongoClient)
mongoClient
- The client to connect to the collection.public void connect()
public void disconnect()
public void testAggregate()
Using the drivers support classes:
import static
com.allanbank.mongodb.builder.AggregateGroupField.set
; import staticcom.allanbank.mongodb.builder.AggregateGroupId.id
; import staticcom.allanbank.mongodb.builder.AggregateProjectFields.includeWithoutId
; import staticcom.allanbank.mongodb.builder.QueryBuilder.where
; import staticcom.allanbank.mongodb.builder.Sort.asc
; import staticcom.allanbank.mongodb.builder.Sort.desc
; import staticcom.allanbank.mongodb.builder.expression.Expressions.constant
; import staticcom.allanbank.mongodb.builder.expression.Expressions.field
; import staticcom.allanbank.mongodb.builder.expression.Expressions.set
; DocumentBuilder b1 = BuilderFactory.start(); DocumentBuilder b2 = BuilderFactory.start(); Aggregate.Builder builder = new Aggregate.Builder(); builder.match(where("state").notEqualTo("NZ")) .group(id().addField("state").addField("city"), set("pop").sum("pop")) .sort(asc("pop")) .group(id("_id.state"), set("biggestcity").last("_id.city"), set("biggestpop").last("pop"), set("smallestcity").first("_id.city"), set("smallestpop").first("pop")) .project( includeWithoutId(), set("state", field("_id")), set("biggestCity", b1.add(set("name", field("biggestcity"))).add( set("pop", field("biggestpop")))), set("smallestCity", b2.add(set("name", field("smallestcity"))).add( set("pop", field("smallestpop"))))) .sort(desc("biggestCity.pop"));
Using the MongoDB Shell:
> db.things.insert( { state : "NZ", city : "big", pop : 1000 } ); > db.things.insert( { state : "MD", city : "big", pop : 1000 } ); > db.things.insert( { state : "MD", city : "medium", pop : 10 } ); > db.things.insert( { state : "MD", city : "small", pop : 1 } ); > db.things.insert( { state : "CA", city : "big", pop : 10000 } ); > db.things.insert( { state : "CA", city : "small", pop : 11 } ); > db.things.insert( { state : "CA", city : "small", pop : 10 } ); > db.things.insert( { state : "NY", city : "big", pop : 100000 } ); > db.things.insert( { state : "NY", city : "small", pop : 20 } ); > db.things.insert( { state : "NY", city : "small", pop : 5 } ); > db.things.aggregate( [ { $match : { state : { $ne : "NZ" } } }, { $group : { _id : { state : "$state", city : "$city" }, pop : { $sum : "$pop" } } }, { $sort : { pop : 1 } }, { $group : { _id : "$_id.state", biggestcity : { $last : "$_id.city" }, biggestpop : { $last : "$pop" }, smallestcity : { $first : "$_id.city" }, smallestpop : { $first : "$pop" } } }, { $project : { _id : 0, state : "$_id", biggestCity : { name : "$biggestcity", pop: "$biggestpop" }, smallestCity : { name : "$smallestcity", pop : "$smallestpop" } } } { $sort : { "biggestCity.pop : -1 } } ] ); { "result" : [ { "state" : "NY", "biggestCity" : { "name" : "big", "pop" : 100000 }, "smallestCity" : { "name" : "small", "pop" : 25 } }, { "state" : "CA", "biggestCity" : { "name" : "big", "pop" : 10000 }, "smallestCity" : { "name" : "small", "pop" : 21 } }, { "state" : "MD", "biggestCity" : { "name" : "big", "pop" : 1000 }, "smallestCity" : { "name" : "small", "pop" : 1 } } ], "ok" : 1 }
public void testAggregateCursor()
Aggregate
command will use a cursor.public void testAggregateExplain()
public void testAggregateStream()
Aggregate
command will use a cursor.public void testAggregateTimeout()
Aggregate
command will timeout.public void testAggregateWithGeoNear()
public void testBatchedOperations() throws IllegalArgumentException, InterruptedException, ExecutionException
Batching requests is accomplished via the
BatchedAsyncMongoCollection
interface which we get from the
MongoCollection.startBatch()
method. The batch needs to always be
closed to submit the requests so we use a try-finally. In Java 1.7 we
could use a try-with-resources.
ExecutionException
- On a test failure.InterruptedException
- On a test failure.IllegalArgumentException
- On a test failure.public void testBatchedWriteReordered()
public void testBatchedWriteSerialized()
public void testBatchedWriteSerializedAndStop()
public void testCollectionStats()
public void testCount()
public void testCountDocumentToLarge()
public void testCountTimeout() throws ExecutionException, InterruptedException
ExecutionException
- On a test failure.InterruptedException
- On a test failure.public void testCreateCappedCollection()
public void testCreateCollection()
public void testCreateIndex()
public void testDatabaseStats()
public void testDelete()
public void testDeleteDocumentToLarge()
public void testDistinct()
db.addresses.insert({"zip-code": 10010}) db.addresses.insert({"zip-code": 10010}) db.addresses.insert({"zip-code": 99701}) db.addresses.distinct("zip-code"); [ 10010, 99701 ]
public void testDistinctTimeout()
Distinct
will timeout.public void testDropCollection()
public void testDropDatabase() throws InterruptedException
InterruptedException
- On a failure to sleep as part of the test.public void testDropIndex()
public void testExplain()
public void testFindAndModify()
public void testFindAndModifyTimeout()
FindAndModify
command timeout.public void testFindAndModifyWithNonExistantDocumentAndNoUpsert()
public void testFindAndModifyWithUpsert()
public void testFindOneWithSubsetOfFields()
ConditionBuilder.and(java.lang.String)
.public void testFindTimeout()
Find
will timeout.public void testFindWithComment()
ConditionBuilder.and(java.lang.String)
.public void testFindWithCommentInProfile()
ConditionBuilder.and(java.lang.String)
.public void testFindWithSubsetOfFields()
ConditionBuilder.and(java.lang.String)
.public void testGridFs()
public void testGridFsFsck()
public void testGridFsVerify()
public void testGroupBy()
{ domain: "www.mongodb.org" , invoked_at: {d:"2009-11-03", t:"17:14:05"} , response_time: 0.05 , http_action: "GET /display/DOCS/Aggregate" } db.test.group( { cond: {"invoked_at.d": {$gte: "2009-11", $lt: "2009-12"}} , key: {http_action: true} , initial: {count: 0, total_time:0} , reduce: function(doc, out){ out.count++; out.total_time+=doc.response_time } , finalize: function(out){ out.avg_time = out.total_time / out.count } } ); [ { "http_action" : "GET /display/DOCS/Aggregate", "count" : 1, "total_time" : 0.05, "avg_time" : 0.05 } ]
public void testGroupByTimeout()
GroupBy
will timeout.public void testInsertAlreadyExists()
public void testInsertAndFindOne()
public void testInsertDocumentToLarge()
public void testIteratorAsync() throws InterruptedException, ExecutionException
InterruptedException
- On a failure of the test to wait.ExecutionException
- On a test failure.public void testIteratorAsyncRead() throws InterruptedException, ExecutionException
InterruptedException
- On a failure of the test to wait.ExecutionException
- On a test failure.public void testJournalDurabilityThrows()
public void testListCollections()
public void testListDatabases()
public void testMapReduce()
> db.things.insert( { _id : 1, tags : ['dog', 'cat'] } ); > db.things.insert( { _id : 2, tags : ['cat'] } ); > db.things.insert( { _id : 3, tags : ['mouse', 'cat', 'dog'] } ); > db.things.insert( { _id : 4, tags : [] } ); > // map function > m = function(){ ... this.tags.forEach( ... function(z){ ... emit( z , { count : 1 } ); ... } ... ); ...}; > // reduce function > r = function( key , values ){ ... var total = 0; ... for ( var i=0; i
res = db.things.mapReduce(m, r, { out : "myoutput" } ); > res { "result" : "myoutput", "timeMillis" : 12, "counts" : { "input" : 4, "emit" : 6, "output" : 3 }, "ok" : 1, } > db.myoutput.find() {"_id" : "cat" , "value" : {"count" : 3}} {"_id" : "dog" , "value" : {"count" : 2}} {"_id" : "mouse" , "value" : {"count" : 1}}
public void testMapReduceTimeout()
MapReduce
will timeout.public void testMultiFetchIterator()
public void testMultiFetchIteratorWithLimit()
public void testMultiFetchIteratorWithLimitRestart()
public void testParallelScan()
parallelCollectionScan
command.public void testParallelScanOnSecondary()
parallelCollectionScan
command will timeout.public void testProfilingStatus()
public void testQueryDocumentToLarge()
public void testQueryWithAll()
public void testQueryWithAnd()
ConditionBuilder.and(java.lang.String)
.public void testQueryWithElementMatches()
public void testQueryWithEqualsBoolean()
ConditionBuilder.equals(boolean)
.public void testQueryWithEqualsByteArray()
ConditionBuilder.equals(byte[])
.public void testQueryWithEqualsByteByteArray()
ConditionBuilder.equals(byte, byte[])
.public void testQueryWithEqualsDocumentAssignable()
ConditionBuilder.equals(DocumentAssignable)
.public void testQueryWithEqualsDoubleCloseToInteger()
ConditionBuilder.equals(double)
.public void testQueryWithEqualsDoubleNotCloseToInt()
ConditionBuilder.equals(double)
.public void testQueryWithEqualsInt()
ConditionBuilder.equals(int)
.public void testQueryWithEqualsJavaScriptString()
ConditionBuilder.equalsJavaScript(String)
.public void testQueryWithEqualsJavaScriptStringDocument()
ConditionBuilder.equalsJavaScript(String, DocumentAssignable)
.public void testQueryWithEqualsLong()
ConditionBuilder.equals(long)
.public void testQueryWithEqualsMaxKey()
ConditionBuilder.equalsMaxKey()
.public void testQueryWithEqualsMinKey()
ConditionBuilder.equalsMinKey()
.public void testQueryWithEqualsMongoTimestamp()
ConditionBuilder.equalsMongoTimestamp(long)
.public void testQueryWithEqualsMongoTimestampFailsWhenEncountersATimestamp()
ConditionBuilder.equalsMongoTimestamp(long)
.public void testQueryWithEqualsNull()
ConditionBuilder.equalsNull()
.public void testQueryWithEqualsObjectId()
ConditionBuilder.equals(ObjectId)
.public void testQueryWithEqualsPattern()
ConditionBuilder.equals(java.util.regex.Pattern)
.public void testQueryWithEqualsString()
ConditionBuilder.equals(String)
.public void testQueryWithEqualsSymbol()
ConditionBuilder.equalsSymbol(String)
.public void testQueryWithEqualsTimestamp()
ConditionBuilder.equalsTimestamp(long)
.public void testQueryWithExists()
ConditionBuilder.exists()
.public void testQueryWithGeoWithinDocumentAssignable()
ConditionBuilder.geoWithin(DocumentAssignable)
.@Deprecated public void testQueryWithGeoWithinUniqueDocsFalse()
ConditionBuilder.geoWithin(DocumentAssignable)
.public void testQueryWithGeoWithinWithMultiPointField()
ConditionBuilder.geoWithin(DocumentAssignable)
.public void testQueryWithGreaterThanByteArray()
ConditionBuilder.greaterThan(byte[])
.public void testQueryWithGreaterThanByteByteArray()
ConditionBuilder.greaterThan(byte, byte[])
.public void testQueryWithGreaterThanDouble()
ConditionBuilder.greaterThan(double)
.public void testQueryWithGreaterThanInt()
ConditionBuilder.greaterThan(int)
.public void testQueryWithGreaterThanLong()
ConditionBuilder.greaterThan(long)
.public void testQueryWithGreaterThanMongoTimestamp()
ConditionBuilder.greaterThanMongoTimestamp(long)
.public void testQueryWithGreaterThanObjectId()
ConditionBuilder.greaterThan(ObjectId)
.public void testQueryWithGreaterThanOrEqualToByteArray()
ConditionBuilder.greaterThanOrEqualTo(byte[])
.public void testQueryWithGreaterThanOrEqualToByteByteArray()
ConditionBuilder.greaterThanOrEqualTo(byte, byte[])
.public void testQueryWithGreaterThanOrEqualToDouble()
ConditionBuilder.greaterThanOrEqualTo(double)
.public void testQueryWithGreaterThanOrEqualToInt()
ConditionBuilder.greaterThanOrEqualTo(int)
.public void testQueryWithGreaterThanOrEqualToLong()
ConditionBuilder.greaterThanOrEqualTo(long)
.public void testQueryWithGreaterThanOrEqualToMongoTimestamp()
ConditionBuilder.greaterThanOrEqualToMongoTimestamp(long)
.public void testQueryWithGreaterThanOrEqualToObjectId()
ConditionBuilder.greaterThanOrEqualTo(ObjectId)
.public void testQueryWithGreaterThanOrEqualToString()
ConditionBuilder.greaterThanOrEqualTo(String)
.public void testQueryWithGreaterThanOrEqualToSymbol()
ConditionBuilder.greaterThanOrEqualToSymbol(String)
.public void testQueryWithGreaterThanOrEqualToTimestamp()
ConditionBuilder.greaterThanOrEqualToTimestamp(long)
.public void testQueryWithGreaterThanString()
ConditionBuilder.greaterThan(String)
.public void testQueryWithGreaterThanSymbol()
ConditionBuilder.greaterThanSymbol(String)
.public void testQueryWithGreaterThanTimestamp()
ConditionBuilder.greaterThanTimestamp(long)
.public void testQueryWithIn()
ConditionBuilder.in(com.allanbank.mongodb.bson.builder.ArrayBuilder)
.public void testQueryWithInstanceOf()
ConditionBuilder.instanceOf(ElementType)
.public void testQueryWithIntersectsDocumentAssignable()
ConditionBuilder.intersects(DocumentAssignable)
.public void testQueryWithLessThanByteArray()
ConditionBuilder.lessThan(byte[])
.public void testQueryWithLessThanByteByteArray()
ConditionBuilder.lessThan(byte, byte[])
.public void testQueryWithLessThanDouble()
ConditionBuilder.lessThan(double)
.public void testQueryWithLessThanInt()
ConditionBuilder.lessThan(int)
.public void testQueryWithLessThanLong()
ConditionBuilder.lessThan(long)
.public void testQueryWithLessThanMongoTimestamp()
ConditionBuilder.lessThanMongoTimestamp(long)
.public void testQueryWithLessThanObjectId()
ConditionBuilder.lessThan(ObjectId)
.public void testQueryWithLessThanOrEqualToByteArray()
ConditionBuilder.lessThanOrEqualTo(byte[])
.public void testQueryWithLessThanOrEqualToByteByteArray()
ConditionBuilder.lessThanOrEqualTo(byte, byte[])
.public void testQueryWithLessThanOrEqualToDouble()
ConditionBuilder.lessThanOrEqualTo(double)
.public void testQueryWithLessThanOrEqualToInt()
ConditionBuilder.lessThanOrEqualTo(int)
.public void testQueryWithLessThanOrEqualToLong()
ConditionBuilder.lessThanOrEqualTo(long)
.public void testQueryWithLessThanOrEqualToMongoTimestamp()
ConditionBuilder.lessThanOrEqualToMongoTimestamp(long)
.public void testQueryWithLessThanOrEqualToObjectId()
ConditionBuilder.lessThanOrEqualTo(ObjectId)
.public void testQueryWithLessThanOrEqualToString()
ConditionBuilder.lessThanOrEqualTo(String)
.public void testQueryWithLessThanOrEqualToSymbol()
ConditionBuilder.lessThanOrEqualToSymbol(String)
.public void testQueryWithLessThanOrEqualToTimestamp()
ConditionBuilder.lessThanOrEqualToTimestamp(long)
.public void testQueryWithLessThanString()
ConditionBuilder.lessThan(String)
.public void testQueryWithLessThanSymbol()
ConditionBuilder.lessThanSymbol(String)
.public void testQueryWithLessThanTimestamp()
ConditionBuilder.lessThanTimestamp(long)
.public void testQueryWithMatches()
ConditionBuilder.matches(java.util.regex.Pattern)
.public void testQueryWithModWithInt()
ConditionBuilder.mod(int, int)
.public void testQueryWithModWithLong()
ConditionBuilder.mod(long, long)
.public void testQueryWithNearDocumentAssignable()
ConditionBuilder.near(DocumentAssignable)
.public void testQueryWithNearDocumentAssignableDouble()
ConditionBuilder.near(DocumentAssignable, double)
.public void testQueryWithNearDoubleDouble()
ConditionBuilder.near(double, double)
.public void testQueryWithNearDoubleDoubleDouble()
ConditionBuilder.near(double, double, double)
.public void testQueryWithNearIntInt()
ConditionBuilder.near(int, int)
.public void testQueryWithNearIntIntInt()
ConditionBuilder.near(int, int, int)
.public void testQueryWithNearLongLong()
ConditionBuilder.near(long, long)
.public void testQueryWithNearLongLongLong()
ConditionBuilder.near(long, long, long)
.public void testQueryWithNearSphereDocumentAssignable()
ConditionBuilder.nearSphere(DocumentAssignable)
.public void testQueryWithNearSphereDocumentAssignableDouble()
ConditionBuilder.nearSphere(DocumentAssignable, double)
.public void testQueryWithNearSphereDoubleDouble()
ConditionBuilder.nearSphere(double, double)
.public void testQueryWithNearSphereDoubleDoubleDouble()
ConditionBuilder.nearSphere(double, double, double)
.public void testQueryWithNearSphereIntInt()
ConditionBuilder.nearSphere(int, int)
.public void testQueryWithNearSphereIntIntInt()
ConditionBuilder.nearSphere(int, int, int)
.public void testQueryWithNearSphereLongLong()
ConditionBuilder.nearSphere(long, long)
.public void testQueryWithNearSphereLongLongLong()
ConditionBuilder.nearSphere(long, long, long)
.public void testQueryWithNotEqualToBoolean()
ConditionBuilder.notEqualTo(boolean)
.public void testQueryWithNotEqualToByteArray()
ConditionBuilder.notEqualTo(byte[])
.public void testQueryWithNotEqualToByteByteArray()
ConditionBuilder.notEqualTo(byte, byte[])
.public void testQueryWithNotEqualToDocumentAssignable()
ConditionBuilder.notEqualTo(DocumentAssignable)
.public void testQueryWithNotEqualToDouble()
ConditionBuilder.notEqualTo(double)
.public void testQueryWithNotEqualToInt()
ConditionBuilder.notEqualTo(int)
.public void testQueryWithNotEqualToJavaScriptString()
ConditionBuilder.notEqualToJavaScript(String)
.public void testQueryWithNotEqualToJavaScriptStringDocument()
ConditionBuilder.notEqualToJavaScript(String, DocumentAssignable)
.public void testQueryWithNotEqualToLong()
ConditionBuilder.notEqualTo(long)
.public void testQueryWithNotEqualToMaxKey()
ConditionBuilder.notEqualToMaxKey()
.public void testQueryWithNotEqualToMinKey()
ConditionBuilder.notEqualToMinKey()
.public void testQueryWithNotEqualToMongoTimestamp()
ConditionBuilder.notEqualToMongoTimestamp(long)
.public void testQueryWithNotEqualToNull()
ConditionBuilder.notEqualToNull()
.public void testQueryWithNotEqualToObjectId()
ConditionBuilder.notEqualTo(ObjectId)
.public void testQueryWithNotEqualToPattern()
ConditionBuilder.notEqualTo(Pattern)
.public void testQueryWithNotEqualToString()
ConditionBuilder.notEqualTo(String)
.public void testQueryWithNotEqualToSymbol()
ConditionBuilder.notEqualToSymbol(String)
.public void testQueryWithNotEqualToTimestamp()
ConditionBuilder.notEqualToTimestamp(long)
.public void testQueryWithNotIn()
public void testQueryWithSize()
ConditionBuilder.size(int)
.public void testQueryWithWhere()
ConditionBuilder.where(String)
.@Deprecated public void testQueryWithWithinBooleanPoint2DPoint2DPoint2DPoint2DArray()
ConditionBuilder.within(boolean, Point2D, Point2D, Point2D, Point2D[])
.public void testQueryWithWithinDocumentAssignable()
ConditionBuilder.within(DocumentAssignable)
.@Deprecated public void testQueryWithWithinDocumentAssignableBoolean()
ConditionBuilder.within(double, double, double, double, boolean)
.public void testQueryWithWithinDoubleDoubleDouble()
ConditionBuilder.within(double, double, double)
.@Deprecated public void testQueryWithWithinDoubleDoubleDoubleBoolean()
ConditionBuilder.within(double, double, double, boolean)
.public void testQueryWithWithinDoubleDoubleDoubleDouble()
ConditionBuilder.within(double, double, double, double)
.@Deprecated public void testQueryWithWithinDoubleDoubleDoubleDoubleBoolean()
ConditionBuilder.within(double, double, double, double, boolean)
.public void testQueryWithWithinIntIntInt()
ConditionBuilder.within(int, int, int)
.@Deprecated public void testQueryWithWithinIntIntIntBoolean()
ConditionBuilder.within(int, int, int, boolean)
.public void testQueryWithWithinIntIntIntInt()
ConditionBuilder.within(int, int, int, int)
.@Deprecated public void testQueryWithWithinIntIntIntIntBoolean()
ConditionBuilder.within(int, int, int, int, boolean)
.public void testQueryWithWithinLongLongLong()
ConditionBuilder.within(long, long, long)
.@Deprecated public void testQueryWithWithinLongLongLongBoolean()
ConditionBuilder.within(long, long, long, boolean)
.public void testQueryWithWithinLongLongLongLong()
ConditionBuilder.within(long, long, long, long)
.@Deprecated public void testQueryWithWithinLongLongLongLongBoolean()
ConditionBuilder.within(long, long, long, long, boolean)
.public void testQueryWithWithinOnSphereDoubleDoubleDouble()
ConditionBuilder.withinOnSphere(double, double, double)
.@Deprecated public void testQueryWithWithinOnSphereDoubleDoubleDoubleBoolean()
ConditionBuilder.withinOnSphere(double, double, double, boolean)
.public void testQueryWithWithinOnSphereIntIntInt()
ConditionBuilder.withinOnSphere(int, int, int)
.@Deprecated public void testQueryWithWithinOnSphereIntIntIntBoolean()
ConditionBuilder.withinOnSphere(int, int, int, boolean)
.public void testQueryWithWithinOnSphereLongLongLong()
ConditionBuilder.withinOnSphere(long, long, long)
.@Deprecated public void testQueryWithWithinOnSphereLongLongLongBoolean()
ConditionBuilder.withinOnSphere(long, long, long, boolean)
.public void testQueryWithWithinOnSphereWrapDoesNotWork()
ConditionBuilder.withinOnSphere(double, double, double)
.public void testQueryWithWithinPoint2DPoint2DPoint2DPoint2DArray()
ConditionBuilder.within(Point2D, Point2D, Point2D, Point2D[])
.public void testRestartWithBadCursorIdFails()
public void testSaveWithId()
public void testSaveWithoutId()
public void testStreamingFind()
@Deprecated public void testStreamingFindLegacy()
@Deprecated public void testTextSearch()
text
command was deprecated in the
2.6 version of MongoDB. Use the
$text
query operator
instead. This test will not be removed until two releases
after the MongoDB 2.6 release (e.g. 2.10 if the releases are
2.8 and 2.10).text
command.
> db.collection.find()
{ "_id" : ObjectId("51376a80602c316554cfe246"), "content" : "Now is the time to drink all of the coffee." }
{ "_id" : ObjectId("51376a89602c316554cfe247"), "content" : "Now is the time to drink all of the tea!" }
{ "_id" : ObjectId("51376ab8602c316554cfe248"), "content" : "Coffee is full of magical powers." }
> db.collection.runCommand( { "text": "collection" , search: "coffee magic" } )
{
"queryDebugString" : "coffe|magic||||||",
"language" : "english",
"results" : [
{
"score" : 2.25,
"obj" : {
"_id" : ObjectId("51376ab8602c316554cfe248"),
"content" : "Coffee is full of magical powers."
}
},
{
"score" : 0.625,
"obj" : {
"_id" : ObjectId("51376a80602c316554cfe246"),
"content" : "Now is the time to drink all of the coffee."
}
}
],
"stats" : {
"nscanned" : 3,
"nscannedObjects" : 0,
"n" : 2,
"nfound" : 2,
"timeMicros" : 97
},
"ok" : 1
}
public void testUpdate()
public void testUpdateDocumentToLarge()
public void testUpdateDurabilityFails()
public void testUpdateOptions()
public void testUpdateQueryToLarge()
public void testUpdateWithSetAndUnset()
public void testValidate()
protected double distance(double x1, double y1, double x2, double y2)
x1
- The first x coordinate.y1
- The first y coordinate.x2
- The second x coordinate.y2
- The second y coordinate.protected void fatal(Throwable t)
t
- The cause of the failure.protected MongoCollection getGeoCollection()
protected MongoCollection getGeoSphereCollection()
protected boolean isReplicaSetConfiguration()
protected boolean isShardedConfiguration()
protected void shardCollection(String collectionName)
collectionName
- The name of the collection to shard.Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.