Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-02-20 10:56:39 +0000
committerEike Stepper2011-02-20 10:56:39 +0000
commit2ea5d6335d98b0bea990ca4187b2e68ac3276a4b (patch)
tree7731f6741860fd1a3239c9cca18b7469b0d5772f /plugins/org.eclipse.emf.cdo.server.mongodb/src
parent8cd9b2a38865a31126307e003dabada5be547fef (diff)
downloadcdo-2ea5d6335d98b0bea990ca4187b2e68ac3276a4b.tar.gz
cdo-2ea5d6335d98b0bea990ca4187b2e68ac3276a4b.tar.xz
cdo-2ea5d6335d98b0bea990ca4187b2e68ac3276a4b.zip
[337152] [Mongo] Create a MongoDBStore
https://bugs.eclipse.org/bugs/show_bug.cgi?id=337152
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server.mongodb/src')
-rw-r--r--plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/Commits.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/Commits.java b/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/Commits.java
index d103fb70ea..d7d79c64a3 100644
--- a/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/Commits.java
+++ b/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/internal/mongodb/Commits.java
@@ -511,7 +511,9 @@ public class Commits extends Coll
query.put(COMMITS_BRANCH, branch.getID());
}
- query.put(REVISIONS + "." + REVISIONS_VERSION, -version - 1);
+ int nextVersion = version + 1;
+ query.put("$or", new DBObject[] { new BasicDBObject(REVISIONS + "." + REVISIONS_VERSION, nextVersion),
+ new BasicDBObject(REVISIONS + "." + REVISIONS_VERSION, -nextVersion) });
Long result = new Query<Long>(query)
{
@@ -524,10 +526,13 @@ public class Commits extends Coll
if (result != null)
{
+ long revised = result - 1;
+
// TODO Cache REVISIONS_REVISED
- // revision.put(REVISIONS_REVISED, result);
- // collection.save(doc);
- return result;
+ revision.put(REVISIONS_REVISED, result);
+ collection.save(doc);
+
+ return revised;
}
return CDOBranchPoint.UNSPECIFIED_DATE;

Back to the top