You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2018/01/29 10:48:27 UTC
[camel] branch master updated: CAMEL-12206: use Bson instead of
Document
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new cc0c9c6 CAMEL-12206: use Bson instead of Document
cc0c9c6 is described below
commit cc0c9c6240449553cf8c4d0d1f301c527f9d0bc6
Author: Oliver Koch <o....@synoa.de>
AuthorDate: Mon Jan 29 11:33:24 2018 +0100
CAMEL-12206: use Bson instead of Document
MongoDbProducer should expect org.bson.conversions.Bson instead of org.bson.Document in createDoRemove
---
.../java/org/apache/camel/component/mongodb3/MongoDbProducer.java | 2 +-
.../org/apache/camel/component/mongodb3/MongoDbOperationsTest.java | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/components/camel-mongodb3/src/main/java/org/apache/camel/component/mongodb3/MongoDbProducer.java b/components/camel-mongodb3/src/main/java/org/apache/camel/component/mongodb3/MongoDbProducer.java
index d56e83b..17cd024 100644
--- a/components/camel-mongodb3/src/main/java/org/apache/camel/component/mongodb3/MongoDbProducer.java
+++ b/components/camel-mongodb3/src/main/java/org/apache/camel/component/mongodb3/MongoDbProducer.java
@@ -492,7 +492,7 @@ public class MongoDbProducer extends DefaultProducer {
return exchange -> {
try {
MongoCollection<Document> dbCol = calculateCollection(exchange);
- Document removeObj = exchange.getIn().getMandatoryBody(Document.class);
+ Bson removeObj = exchange.getIn().getMandatoryBody(Bson.class);
DeleteResult result = dbCol.deleteMany(removeObj);
if (result.wasAcknowledged()) {
diff --git a/components/camel-mongodb3/src/test/java/org/apache/camel/component/mongodb3/MongoDbOperationsTest.java b/components/camel-mongodb3/src/test/java/org/apache/camel/component/mongodb3/MongoDbOperationsTest.java
index fb7e09d..f4e643e 100644
--- a/components/camel-mongodb3/src/test/java/org/apache/camel/component/mongodb3/MongoDbOperationsTest.java
+++ b/components/camel-mongodb3/src/test/java/org/apache/camel/component/mongodb3/MongoDbOperationsTest.java
@@ -24,6 +24,7 @@ import java.util.List;
import static java.util.Arrays.asList;
import com.mongodb.MongoClient;
+import com.mongodb.client.model.Filters;
import com.mongodb.client.result.DeleteResult;
import com.mongodb.client.result.UpdateResult;
@@ -271,7 +272,7 @@ public class MongoDbOperationsTest extends AbstractMongoDbTest {
assertEquals(0, testCollection.count());
for (int i = 1; i <= 100; i++) {
String body = null;
- try (Formatter f = new Formatter();) {
+ try (Formatter f = new Formatter()) {
if (i % 2 == 0) {
body = f.format("{\"_id\":\"testSave%d\", \"scientist\":\"Einstein\"}", i).toString();
} else {
@@ -284,7 +285,7 @@ public class MongoDbOperationsTest extends AbstractMongoDbTest {
assertEquals(100L, testCollection.count());
// Testing the update logic
- Document extraField = new Document("extraField", true);
+ Bson extraField = Filters.eq("extraField", true);
assertEquals("Number of records with 'extraField' flag on must equal 50", 50L, testCollection.count(extraField));
Exchange resultExchange = template.request("direct:remove", new Processor() {
--
To stop receiving notification emails like this one, please contact
acosentino@apache.org.