Merge branch 'release' of https://github.com/appsmithorg/appsmith into release

This commit is contained in:
Automated Github Action 2020-09-04 06:06:49 +00:00
commit e9041d66de
3 changed files with 14 additions and 10 deletions

View File

@ -19,12 +19,7 @@ assignees: Nikhil-Nandagopal
Good items to include here include:
- Console / network logs from your browser
### What you expected to happen
A clear and concise description of what you expected to happen.
### Screenshots
If applicable, add screenshots to help explain your problem.
- Screenshots
### Important Details

View File

@ -118,8 +118,10 @@ public class MongoPlugin extends BasePlugin {
// For the `findAndModify` command, we don't get the count of modifications made. Instead, we either
// get the modified new value or the pre-modified old value (depending on the `new` field in the
// command. Let's return that value to the user.
if (mongoOutput.containsKey(VALUE_STR)) {
result.setBody(new JSONObject().put(VALUE_STR, mongoOutput.get(VALUE_STR)));
if (outputJson.has(VALUE_STR)) {
result.setBody(objectMapper.readTree(
cleanUp(new JSONObject().put(VALUE_STR, outputJson.get(VALUE_STR))).toString()
));
}
//The json contains key "cursor" when find command was issued and there are 1 or more results. In case

View File

@ -7,6 +7,7 @@ import com.appsmith.external.models.DatasourceConfiguration;
import com.appsmith.external.models.Endpoint;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mongodb.MongoClient;
import com.mongodb.client.MongoCollection;
import org.bson.Document;
@ -38,6 +39,7 @@ public class MongoPluginTest {
@ClassRule
public static GenericContainer mongoContainer = new GenericContainer("mongo:4.2.0")
.withExposedPorts(27017);
private JsonNode value;
@Before
public void setUp() {
@ -172,6 +174,11 @@ public class MongoPluginTest {
assertNotNull(result);
assertTrue(result.getIsExecutionSuccess());
assertNotNull(result.getBody());
value = ((ObjectNode) result.getBody()).get("value");
assertNotNull(value);
assertEquals("M", value.get("gender").asText());
assertEquals("Alden Cantrell", value.get("name").asText());
assertEquals(30, value.get("age").asInt());
})
.verifyComplete();
}
@ -200,8 +207,8 @@ public class MongoPluginTest {
final JsonNode node = body.get(0);
assertTrue(node.get("_id").isTextual());
assertTrue(node.get("luckyNumber").isNumber());
assertEquals(node.get("dob").asText(), "2018-12-31T00:00:00Z");
assertEquals(node.get("netWorth").toString(), "123456.789012");
assertEquals("2018-12-31T00:00:00Z", node.get("dob").asText());
assertEquals("123456.789012", node.get("netWorth").toString());
})
.verifyComplete();
}