-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.9.3
-
Component/s: API
-
Environment:$ uname -a
Linux 3.5.0-24-generic #37-Ubuntu SMP Thu Feb 7 01:50:30 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
$ mongo --version
MongoDB shell version: 2.0.6
$ mongod --version
db version v2.0.6, pdfile version 4.5
Tue Feb 12 18:53:04 git version: nogitversion
$ java -version
java version "1.7.0_13"
Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)$ uname -a Linux 3.5.0-24-generic #37-Ubuntu SMP Thu Feb 7 01:50:30 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux $ mongo --version MongoDB shell version: 2.0.6 $ mongod --version db version v2.0.6, pdfile version 4.5 Tue Feb 12 18:53:04 git version: nogitversion $ java -version java version "1.7.0_13" Java(TM) SE Runtime Environment (build 1.7.0_13-b20) Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
Hello,
I am reading data from mongo in Java, with this code:
DBObject dbo = new BasicDBObject(LOCKED_DOC_ID_FIELD, gdto.getDocId()); DBCursor lock = locks.find(dbo); if (lock.count() == 1) { DBObject lockDBO = lock.next(); long createdAtTS = (Long) lockDBO.get(CREATED_AT_FIELD); Date d = new Date(createdAtTS); return new Lock(gdto, d); } else if (lock.count() > 1) { throw new IllegalStateException("It seems like mongoDB locks.locks collection does not have a unique index on lockedId. Do: use locks; db.locks.ensureIndex({lockedDocId:1}, {unique:true})"); }
I somtimes get an Exception on `DBObject lockDBO = lock.next();`:
java.lang.RuntimeException: no more
at com.mongodb.DBApiLayer$Result.next(DBApiLayer.java:388)
at com.mongodb.DBApiLayer$Result.next(DBApiLayer.java:350)
at com.mongodb.DBCursor._next(DBCursor.java:421)
at com.mongodb.DBCursor.next(DBCursor.java:494)
How can this be?
Thanks for your precious help.
Brice.