本文整理汇总了Java中com.redhat.lightblue.query.Projection类的典型用法代码示例。如果您正苦于以下问题:Java Projection类的具体用法?Java Projection怎么用?Java Projection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Projection类属于com.redhat.lightblue.query包,在下文中一共展示了Projection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addArrayIdentities
import com.redhat.lightblue.query.Projection; //导入依赖的package包/类
private Projection addArrayIdentities(Projection p,EntityMetadata md) {
// If an array is included in the projection, make sure its identity is also included
Map<Path,List<Path>> arrayIdentities=md.getEntitySchema().getArrayIdentities();
List<Projection> addFields=new ArrayList<>();
for(Map.Entry<Path,List<Path>> entry:arrayIdentities.entrySet()) {
Path array=entry.getKey();
List<Path> identities=new ArrayList<>();
for(Path x:entry.getValue())
identities.add(new Path(array,new Path(Path.ANYPATH,x)));
if(isProjected(array,p)) {
for(Path id:identities) {
if(!isProjected(id,p)) {
addFields.add(new FieldProjection(id,true,true));
}
}
}
}
if(!addFields.isEmpty()) {
LOGGER.debug("Excluded array identities are added to projection:{}",addFields);
// Need to first add the original projection, then the included fields.
// This is order sensitive
return Projection.add(p,new ProjectionList(addFields));
} else
return p;
}
开发者ID:esbtools,项目名称:lightblue-notification-hook,代码行数:27,代码来源:NotificationHook.java
示例2: EventConfiguration
import com.redhat.lightblue.query.Projection; //导入依赖的package包/类
public EventConfiguration(
String esbRootEntityName,
String esbEventEntityName,
String endSystem,
Projection integratedFieldsProjection,
Projection identityProjection,
List<String> rootIdentityFields,
List<Header> headers) {
this.esbRootEntityName = esbRootEntityName;
this.esbEventEntityName = esbEventEntityName;
this.endSystem = endSystem;
this.integratedFieldsProjection = integratedFieldsProjection;
this.identityProjection = identityProjection;
this.rootIdentityFields = rootIdentityFields;
this.headers = headers;
}
开发者ID:lightblue-platform,项目名称:lightblue-esb-hook,代码行数:17,代码来源:EventConfiguration.java
示例3: buildSimpleRequest
import com.redhat.lightblue.query.Projection; //导入依赖的package包/类
public static FindRequest buildSimpleRequest(String entity, String version, String q, String p, String s, Long from, Long to, Long maxResults)
throws IOException {
// spec -> https://github.com/lightblue-platform/lightblue/wiki/Rest-Spec-Data#get-simple-find
String sq = QueryTemplateUtils.buildQueryFieldsTemplate(q);
LOGGER.debug("query: {} -> {}", q, sq);
String sp = QueryTemplateUtils.buildProjectionsTemplate(p);
LOGGER.debug("projection: {} -> {}", p, sp);
String ss = QueryTemplateUtils.buildSortsTemplate(s);
LOGGER.debug("sort:{} -> {}", s, ss);
FindRequest findRequest = new FindRequest();
findRequest.setEntityVersion(new EntityVersion(entity, version));
findRequest.setQuery(sq == null ? null : QueryExpression.fromJson(JsonUtils.json(sq)));
findRequest.setProjection(sp == null ? null : Projection.fromJson(JsonUtils.json(sp)));
findRequest.setSort(ss == null ? null : Sort.fromJson(JsonUtils.json(ss)));
findRequest.setFrom(from);
if(to!=null) {
findRequest.setTo(to);
} else if(maxResults!=null&&maxResults>0) {
findRequest.setTo((from == null ? 0 : from) + maxResults - 1);
}
return findRequest;
}
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:26,代码来源:LightblueRequestUtils.java
示例4: getSearchesForEntity
import com.redhat.lightblue.query.Projection; //导入依赖的package包/类
@GET
@LZF
@Path("/search/{entity}")
public Response getSearchesForEntity(@PathParam("entity") String entity,
@QueryParam("P") String projection,
@QueryParam("S") String sort) {
FindRequest freq=new FindRequest();
freq.setEntityVersion(new EntityVersion(RestConfiguration.getSavedSearchCache().savedSearchEntity,
RestConfiguration.getSavedSearchCache().savedSearchVersion));
try {
freq.setProjection(projection==null?FieldProjection.ALL:Projection.fromJson(JsonUtils.json(QueryTemplateUtils.buildProjectionsTemplate(projection))));
freq.setSort(sort==null?new SortKey(new com.redhat.lightblue.util.Path("name"),false):Sort.fromJson(JsonUtils.json(QueryTemplateUtils.buildSortsTemplate(sort))));
} catch (Exception e) {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.toString()).build();
}
CallStatus st=new FindCommand(freq.getEntityVersion().getEntity(),
freq.getEntityVersion().getVersion(),
freq.toJson().toString(), METRICS).run();
return Response.status(st.getHttpStatus()).entity(st.toString()).build();
}
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:22,代码来源:AbstractCrudResource.java
示例5: buildSimpleRequest
import com.redhat.lightblue.query.Projection; //导入依赖的package包/类
private FindRequest buildSimpleRequest(String entity,String version, String q,String p, String s, Long from, Long to,Long maxResults)
throws IOException {
// spec -> https://github.com/lightblue-platform/lightblue/wiki/Rest-Spec-Data#get-simple-find
String sq = QueryTemplateUtils.buildQueryFieldsTemplate(q);
LOGGER.debug("query: {} -> {}", q, sq);
String sp = QueryTemplateUtils.buildProjectionsTemplate(p);
LOGGER.debug("projection: {} -> {}", p, sp);
String ss = QueryTemplateUtils.buildSortsTemplate(s);
LOGGER.debug("sort:{} -> {}", s, ss);
FindRequest findRequest = new FindRequest();
findRequest.setEntityVersion(new EntityVersion(entity, version));
findRequest.setQuery(sq == null ? null : QueryExpression.fromJson(JsonUtils.json(sq)));
findRequest.setProjection(sp == null ? null : Projection.fromJson(JsonUtils.json(sp)));
findRequest.setSort(ss == null ? null : Sort.fromJson(JsonUtils.json(ss)));
findRequest.setFrom(from);
if(to!=null) {
findRequest.setTo(to);
} else if(maxResults!=null&&maxResults>0) {
findRequest.setTo((from == null ? 0 : from) + maxResults - 1);
}
return findRequest;
}
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:26,代码来源:AbstractCrudResource.java
示例6: RunSavedSearchCommand
import com.redhat.lightblue.query.Projection; //导入依赖的package包/类
public RunSavedSearchCommand(String searchName,
String entity,
String version,
Projection projection,
Sort sort,
Integer from,
Integer to,
Map<String,String> properties,
RequestMetrics metrics) {
this.searchName=searchName;
this.entity=entity;
this.version=version;
this.projection=projection;
this.sort=sort;
this.from=from;
this.to=to;
this.params=properties;
this.metrics = metrics;
}
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:20,代码来源:RunSavedSearchCommand.java
示例7: getProjectionFields
import com.redhat.lightblue.query.Projection; //导入依赖的package包/类
/**
* Returns a projection containing the requested projection, all identity
* fields, and the objectType field
*/
private Projection getProjectionFields(Projection requestedProjection,
EntityMetadata md) {
Field[] identityFields = md.getEntitySchema().getIdentityFields();
List<Projection> projectFields = new ArrayList<>(identityFields == null ? 1 : identityFields.length + 1);
if (requestedProjection instanceof ProjectionList) {
projectFields.addAll(((ProjectionList) requestedProjection).getItems());
} else if (requestedProjection != null) {
projectFields.add(requestedProjection);
}
if (identityFields != null) {
for (Field x : identityFields) {
projectFields.add(new FieldProjection(x.getFullPath(), true, false));
}
}
projectFields.add(new FieldProjection(DocTranslator.OBJECT_TYPE, true, false));
return new ProjectionList(projectFields);
}
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:23,代码来源:MongoCRUDController.java
示例8: insertTest
import com.redhat.lightblue.query.Projection; //导入依赖的package包/类
@Test
public void insertTest() throws Exception {
EntityMetadata md = getMd("./testMetadata.json");
TestCRUDOperationContext ctx = new TestCRUDOperationContext(CRUDOperation.INSERT);
ctx.add(md);
JsonDoc doc = new JsonDoc(loadJsonNode("./testdata1.json"));
Projection projection = projection("{'field':'_id'}");
addDocument(ctx,doc);
CRUDInsertionResponse response = controller.insert(ctx, projection);
System.out.println(getDataErrors(ctx));
List<DocCtx> documents=streamToList(ctx);
Assert.assertEquals(1, documents.size());
Assert.assertTrue(ctx.getErrors() == null || ctx.getErrors().isEmpty());
Assert.assertTrue(getDataErrors(ctx).isEmpty());
Assert.assertEquals(ctx.getInputDocumentsWithoutErrors().size(), response.getNumInserted());
String id = documents.get(0).getOutputDocument().get(new Path("_id")).asText();
try (DBCursor c = coll.find(new BasicDBObject("_id", DocTranslator.createIdFrom(id)))) {
Assert.assertEquals(1, c.count());
}
Assert.assertNotNull(documents.get(0).getResultMetadata());
Assert.assertNotNull(documents.get(0).getResultMetadata().getDocumentVersion());
}
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:23,代码来源:MongoCRUDControllerTest.java
示例9: insertTest_nullReqField
import com.redhat.lightblue.query.Projection; //导入依赖的package包/类
@Test
public void insertTest_nullReqField() throws Exception {
EntityMetadata md = getMd("./testMetadata-requiredFields2.json");
TestCRUDOperationContext ctx = new TestCRUDOperationContext(CRUDOperation.INSERT);
ctx.add(md);
JsonDoc doc = new JsonDoc(loadJsonNode("./testdata1.json"));
doc.modify(new Path("field1"), null, false);
Projection projection = projection("{'field':'_id'}");
addDocument(ctx,doc);
CRUDInsertionResponse response = controller.insert(ctx, projection);
List<DocCtx> documents=streamToList(ctx);
System.out.println(getDataErrors(ctx));
Assert.assertEquals(1, documents.size());
Assert.assertTrue(ctx.getErrors() == null || ctx.getErrors().isEmpty());
Assert.assertTrue( getDataErrors(ctx).isEmpty());
Assert.assertEquals(ctx.getInputDocumentsWithoutErrors().size(), response.getNumInserted());
String id = documents.get(0).getOutputDocument().get(new Path("_id")).asText();
try (DBCursor c = coll.find(new BasicDBObject("_id", DocTranslator.createIdFrom(id)))) {
Assert.assertEquals(1, c.count());
}
}
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:22,代码来源:MongoCRUDControllerTest.java
示例10: insertTest_empty_array
import com.redhat.lightblue.query.Projection; //导入依赖的package包/类
@Test
@Ignore
public void insertTest_empty_array() throws Exception {
EntityMetadata md = getMd("./testMetadata.json");
TestCRUDOperationContext ctx = new TestCRUDOperationContext(CRUDOperation.INSERT);
ctx.add(md);
JsonDoc doc = new JsonDoc(loadJsonNode("./testdata_empty_array.json"));
Projection projection = projection("{'field':'field7'}");
addDocument(ctx,doc);
CRUDInsertionResponse response = controller.insert(ctx, projection);
System.out.println(getDataErrors(ctx));
List<DocCtx> documents=streamToList(ctx);
Assert.assertEquals(1, documents.size());
Assert.assertTrue(ctx.getErrors() == null || ctx.getErrors().isEmpty());
Assert.assertTrue(getDataErrors(ctx).isEmpty());
Assert.assertEquals(ctx.getInputDocumentsWithoutErrors().size(), response.getNumInserted());
JsonNode field7Node = documents.get(0).getOutputDocument().get(new Path("field7"));
Assert.assertNotNull("empty array was not inserted", field7Node);
Assert.assertTrue("field7 should be type ArrayNode", field7Node instanceof ArrayNode);
String field7 = field7Node.asText();
Assert.assertNotNull("field7");
}
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:23,代码来源:MongoCRUDControllerTest.java
示例11: insertTest_nullProjection
import com.redhat.lightblue.query.Projection; //导入依赖的package包/类
@Test
public void insertTest_nullProjection() throws Exception {
EntityMetadata md = getMd("./testMetadata.json");
TestCRUDOperationContext ctx = new TestCRUDOperationContext(CRUDOperation.INSERT);
ctx.add(md);
JsonDoc doc = new JsonDoc(loadJsonNode("./testdata1.json"));
Projection projection = null;
addDocument(ctx,doc);
CRUDInsertionResponse response = controller.insert(ctx, projection);
List<DocCtx> documents=streamToList(ctx);
// basic checks
Assert.assertEquals(1, documents.size());
Assert.assertTrue(ctx.getErrors() == null || ctx.getErrors().isEmpty());
Assert.assertTrue(getDataErrors(ctx).isEmpty());
Assert.assertEquals(ctx.getInputDocumentsWithoutErrors().size(), response.getNumInserted());
// verify there is nothing projected
Assert.assertNotNull(documents.get(0).getOutputDocument());
}
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:21,代码来源:MongoCRUDControllerTest.java
示例12: saveTest_duplicateKey
import com.redhat.lightblue.query.Projection; //导入依赖的package包/类
@Test
public void saveTest_duplicateKey() throws Exception {
EntityMetadata md = getMd("./testMetadata.json");
TestCRUDOperationContext ctx = new TestCRUDOperationContext(CRUDOperation.INSERT);
ctx.add(md);
JsonDoc doc = new JsonDoc(loadJsonNode("./testdata1.json"));
Projection projection = projection("{'field':'_id'}");
addDocument(ctx,doc);
System.out.println("Write doc:" + doc);
CRUDInsertionResponse response = controller.insert(ctx, projection);
String id = ctx.getInputDocuments().get(0).getOutputDocument().get(new Path("_id")).asText();
doc.modify(new Path("_id"), nodeFactory.textNode(id), false);
ctx = new TestCRUDOperationContext(CRUDOperation.INSERT);
ctx.add(md);
addDocument(ctx,doc);
controller.insert(ctx, projection);
Assert.assertEquals(1, ctx.getInputDocuments().get(0).getErrors().size());
Assert.assertEquals(MongoCrudConstants.ERR_DUPLICATE, ctx.getInputDocuments().get(0).getErrors().get(0).getErrorCode());
}
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:24,代码来源:MongoCRUDControllerTest.java
示例13: updateTest_nullReqField
import com.redhat.lightblue.query.Projection; //导入依赖的package包/类
@Test
public void updateTest_nullReqField() throws Exception {
EntityMetadata md = getMd("./testMetadata-requiredFields2.json");
TestCRUDOperationContext ctx = new TestCRUDOperationContext(CRUDOperation.INSERT);
ctx.add(md);
JsonDoc doc = new JsonDoc(loadJsonNode("./testdata1.json"));
doc.modify(new Path("field1"), JsonNodeFactory.instance.nullNode(), false);
Projection projection = projection("{'field':'_id'}");
addDocument(ctx,doc);
CRUDInsertionResponse response = controller.insert(ctx, projection);
ctx = new TestCRUDOperationContext(CRUDOperation.UPDATE);
ctx.add(md);
CRUDUpdateResponse upd = controller.update(ctx, query("{'field':'field2','op':'=','rvalue':'f2'}"),
update(" {'$set' : {'field3':3 }}"),
projection("{'field':'*','recursive':1}"));
Assert.assertEquals(0, upd.getNumUpdated());
Assert.assertEquals(1, upd.getNumFailed());
Assert.assertEquals(1, getDataErrors(ctx).size());
Assert.assertEquals(1, getDataErrors(ctx).get(0).getErrors().size());
Error error = getDataErrors(ctx).get(0).getErrors().get(0);
Assert.assertEquals("crud:Required", error.getErrorCode());
Assert.assertEquals("field1", error.getMsg());
}
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:27,代码来源:MongoCRUDControllerTest.java
示例14: searchByArrayIndexTest
import com.redhat.lightblue.query.Projection; //导入依赖的package包/类
@Test
public void searchByArrayIndexTest() throws Exception {
EntityMetadata md = getMd("./testMetadata.json");
TestCRUDOperationContext ctx = new TestCRUDOperationContext(CRUDOperation.INSERT);
ctx.add(md);
JsonDoc doc = new JsonDoc(loadJsonNode("./testdata1.json"));
Projection projection = projection("{'field':'_id'}");
addDocument(ctx,doc);
CRUDInsertionResponse response = controller.insert(ctx, projection);
ctx = new TestCRUDOperationContext(CRUDOperation.FIND);
ctx.add(md);
controller.find(ctx, query("{'field':'field7.0.elemf1','op':'$eq','rvalue':'value0_1'}}"),
projection("{'field':'*','recursive':1}"), null, null, null);
List<DocCtx> documents=streamToList(ctx);
Assert.assertEquals(1, documents.size());
}
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:18,代码来源:MongoCRUDControllerTest.java
示例15: useThisInSameArrayTest
import com.redhat.lightblue.query.Projection; //导入依赖的package包/类
@Test
public void useThisInSameArrayTest() throws Exception {
EntityMetadata md = getMd("./testMetadata.json");
TestCRUDOperationContext ctx = new TestCRUDOperationContext(CRUDOperation.INSERT);
ctx.add(md);
JsonDoc doc = new JsonDoc(loadJsonNode("./testdata1.json"));
Projection projection = projection("{'field':'_id'}");
addDocument(ctx,doc);
CRUDInsertionResponse response = controller.insert(ctx, projection);
ctx = new TestCRUDOperationContext(CRUDOperation.FIND);
ctx.add(md);
controller.find(ctx, query("{'array':'field6.nf6','elemMatch':{'field':'$this','op':'$in','rfield':'$parent'}}"),
projection("{'field':'*','recursive':1}"), null, null, null);
List<DocCtx> documents=streamToList(ctx);
Assert.assertEquals(1, documents.size());
}
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:18,代码来源:MongoCRUDControllerTest.java
示例16: useThisInArrayTest
import com.redhat.lightblue.query.Projection; //导入依赖的package包/类
@Test
public void useThisInArrayTest() throws Exception {
EntityMetadata md = getMd("./testMetadata7.json");
TestCRUDOperationContext ctx = new TestCRUDOperationContext(CRUDOperation.INSERT);
ctx.add(md);
JsonDoc doc = new JsonDoc(loadJsonNode("./testdata7.json"));
Projection projection = projection("{'field':'_id'}");
addDocument(ctx,doc);
CRUDInsertionResponse response = controller.insert(ctx, projection);
ctx = new TestCRUDOperationContext(CRUDOperation.FIND);
ctx.add(md);
controller.find(ctx, query("{'array':'field6.nf6','elemMatch':{'field':'$this','op':'$in','rfield':'$parent.$parent.nf8'}}"),
projection("{'field':'*','recursive':1}"), null, null, null);
List<DocCtx> documents=streamToList(ctx);
Assert.assertEquals(1, documents.size());
ctx = new TestCRUDOperationContext(CRUDOperation.FIND);
ctx.add(md);
controller.find(ctx, query("{'array':'field6.nf6','elemMatch':{'field':'$this','op':'$in','rfield':'$parent.$parent.nf9'}}"),
projection("{'field':'*','recursive':1}"), null, null, null);
documents=streamToList(ctx);
Assert.assertEquals(0, documents.size());
}
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:25,代码来源:MongoCRUDControllerTest.java
示例17: useThisInArrayWithRegexTest
import com.redhat.lightblue.query.Projection; //导入依赖的package包/类
@Test
public void useThisInArrayWithRegexTest() throws Exception {
EntityMetadata md = getMd("./testMetadata7.json");
TestCRUDOperationContext ctx = new TestCRUDOperationContext(CRUDOperation.INSERT);
ctx.add(md);
JsonDoc doc = new JsonDoc(loadJsonNode("./testdata7.json"));
Projection projection = projection("{'field':'_id'}");
addDocument(ctx,doc);
CRUDInsertionResponse response = controller.insert(ctx, projection);
ctx = new TestCRUDOperationContext(CRUDOperation.FIND);
ctx.add(md);
controller.find(ctx, query("{'array':'field6.nf6','elemMatch':{'field':'$this','regex':'t.o'}}"),
projection("{'field':'*','recursive':1}"), null, null, null);
List<DocCtx> documents=streamToList(ctx);
Assert.assertEquals(1, documents.size());
}
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:18,代码来源:MongoCRUDControllerTest.java
示例18: useThisNinArrayTest
import com.redhat.lightblue.query.Projection; //导入依赖的package包/类
@Test
public void useThisNinArrayTest() throws Exception {
EntityMetadata md = getMd("./testMetadata7.json");
TestCRUDOperationContext ctx = new TestCRUDOperationContext(CRUDOperation.INSERT);
ctx.add(md);
JsonDoc doc = new JsonDoc(loadJsonNode("./testdata7.json"));
Projection projection = projection("{'field':'_id'}");
addDocument(ctx,doc);
CRUDInsertionResponse response = controller.insert(ctx, projection);
ctx = new TestCRUDOperationContext(CRUDOperation.FIND);
ctx.add(md);
controller.find(ctx, query("{'array':'field6.nf6','elemMatch':{'field':'$this','op':'$nin','rfield':'$parent.$parent.nf8'}}"),
projection("{'field':'*','recursive':1}"), null, null, null);
List<DocCtx> documents=streamToList(ctx);
Assert.assertEquals(0, documents.size());
ctx = new TestCRUDOperationContext(CRUDOperation.FIND);
ctx.add(md);
controller.find(ctx, query("{'array':'field6.nf6','elemMatch':{'field':'$this','op':'$nin','rfield':'$parent.$parent.nf9'}}"),
projection("{'field':'*','recursive':1}"), null, null, null);
documents=streamToList(ctx);
Assert.assertEquals(1, documents.size());
}
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:25,代码来源:MongoCRUDControllerTest.java
示例19: fieldfieldComparisonTest
import com.redhat.lightblue.query.Projection; //导入依赖的package包/类
@Test
public void fieldfieldComparisonTest() throws Exception {
EntityMetadata md = getMd("./testMetadata5.json");
TestCRUDOperationContext ctx = new TestCRUDOperationContext(CRUDOperation.INSERT);
ctx.add(md);
JsonDoc doc = new JsonDoc(loadJsonNode("./testdata5.json"));
// This makes field1=field2
doc.modify(new Path("field2"),JsonNodeFactory.instance.textNode("f1"),false);
Projection projection = projection("{'field':'_id'}");
addDocument(ctx,doc);
CRUDInsertionResponse response = controller.insert(ctx, projection);
ctx = new TestCRUDOperationContext(CRUDOperation.FIND);
ctx.add(md);
controller.find(ctx, query("{'field':'field1','op':'=','rfield':'field2'}"),
projection("{'field':'*','recursive':1}"), null, null, null);
List<DocCtx> documents=streamToList(ctx);
Assert.assertEquals(1, documents.size());
}
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:20,代码来源:MongoCRUDControllerTest.java
示例20: fieldfieldComparisonTest_missingField
import com.redhat.lightblue.query.Projection; //导入依赖的package包/类
@Test
public void fieldfieldComparisonTest_missingField() throws Exception {
EntityMetadata md = getMd("./testMetadata5.json");
TestCRUDOperationContext ctx = new TestCRUDOperationContext(CRUDOperation.INSERT);
ctx.add(md);
JsonDoc doc = new JsonDoc(loadJsonNode("./testdata5.json"));
// This will remove field2
doc.modify(new Path("field2"),null,false);
Projection projection = projection("{'field':'_id'}");
addDocument(ctx,doc);
CRUDInsertionResponse response = controller.insert(ctx, projection);
ctx = new TestCRUDOperationContext(CRUDOperation.FIND);
ctx.add(md);
controller.find(ctx, query("{'field':'field1','op':'=','rfield':'field2'}"),
projection("{'field':'*','recursive':1}"), null, null, null);
List<DocCtx> documents=streamToList(ctx);
Assert.assertEquals(0, documents.size());
// should not throw exception
}
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:21,代码来源:MongoCRUDControllerTest.java
注:本文中的com.redhat.lightblue.query.Projection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论