-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 2.0
-
Component/s: None
-
Labels:None
-
Environment:Windows, java 1.4 driver, mongo 1.3.3
if I do:
db.requestStart();
db.setWriteConcern(WriteConcern.STRICT);
String colName = "testCollection";
DBCollection collection = db.getCollection(colName);
//mongodb.save(getTestObject(), colName);
//long size = collection.getCount();
//assert size == 1;
String colNewName = "testCollection2";
collection.rename(colNewName);
System.out.println("collection name = " + collection.getName());
assert collection.getName().equals(colNewName);
db.requestDone();
then I get:
com.mongodb.MongoException: rename failed:
{ "errmsg" : "assertion: source namespace does not exist" , "ok" : 0.0} at com.mongodb.DBCollection.rename(DBCollection.java:499)
at com.refineddata.MongoDatabaseTest.testCreateExistsRenameDeleteCollection(MongoDatabaseTest.java:70)
which doesn't seem appropriate as namespace should exist, the collection itself exists.
If I save something in the code:
db.requestStart();
db.setWriteConcern(WriteConcern.STRICT);
String colName = "testCollection";
DBCollection collection = db.getCollection(colName);
mongodb.save(getTestObject(), colName);
long size = collection.getCount();
assert size == 1;
String colNewName = "testCollection2";
collection.rename(colNewName);
System.out.println("collection name = " + collection.getName());
assert collection.getName().equals(colNewName);
db.requestDone();
the following is printed:
collection name = testCollection
the following assertion fails (which shouldn't happen as no exception is thrown)
assert collection.getName().equals(colNewName);