Package com.mongodb

Examples of com.mongodb.BasicDBObjectBuilder


    Query query = new Query();

    DBObject dbo = mapper.getMappedFields(query.getFieldsObject(),
        context.getPersistentEntity(WithTextScoreProperty.class));

    assertThat(dbo, equalTo(new BasicDBObjectBuilder().add("score", new BasicDBObject("$meta", "textScore")).get()));
  }
View Full Code Here


    query.fields().include("textScore");

    DBObject dbo = mapper.getMappedFields(query.getFieldsObject(),
        context.getPersistentEntity(WithTextScoreProperty.class));

    assertThat(dbo, equalTo(new BasicDBObjectBuilder().add("score", new BasicDBObject("$meta", "textScore")).get()));
  }
View Full Code Here

    Query query = new Query().with(new Sort("textScore"));

    DBObject dbo = mapper
        .getMappedSort(query.getSortObject(), context.getPersistentEntity(WithTextScoreProperty.class));

    assertThat(dbo, equalTo(new BasicDBObjectBuilder().add("score", new BasicDBObject("$meta", "textScore")).get()));
  }
View Full Code Here

    Query query = new Query().with(new Sort("id"));

    DBObject dbo = mapper
        .getMappedSort(query.getSortObject(), context.getPersistentEntity(WithTextScoreProperty.class));

    assertThat(dbo, equalTo(new BasicDBObjectBuilder().add("_id", 1).get()));
  }
View Full Code Here

    Query query = query(where("nested.id").is("bar"));

    DBObject dbo = mapper.getMappedObject(query.getQueryObject(),
        context.getPersistentEntity(RootForClassWithExplicitlyRenamedIdField.class));

    assertThat(dbo, equalTo(new BasicDBObjectBuilder().add("nested.id", "bar").get()));
  }
View Full Code Here

    Query query = new Query().with(new Sort("nested.id"));

    DBObject dbo = mapper.getMappedSort(query.getSortObject(),
        context.getPersistentEntity(RootForClassWithExplicitlyRenamedIdField.class));

    assertThat(dbo, equalTo(new BasicDBObjectBuilder().add("nested.id", 1).get()));
  }
View Full Code Here

        String.class);
    ConvertingParameterAccessor parameterAccessor = StubParameterAccessor.getAccessor(converter, "key", "value");

    org.springframework.data.mongodb.core.query.Query query = mongoQuery.createQuery(parameterAccessor);

    assertThat(query.getQueryObject(), is(new BasicDBObjectBuilder().add("key", "value").get()));
  }
View Full Code Here

    ArgumentCaptor<Query> captor = ArgumentCaptor.forClass(Query.class);

    verify(this.mongoOperationsMock, times(2))
        .find(captor.capture(), Matchers.eq(Person.class), Matchers.eq("persons"));

    DBObject expectedSortObject = new BasicDBObjectBuilder().add("bar", -1).get();
    assertThat(captor.getAllValues().get(0).getSortObject(), is(expectedSortObject));
    assertThat(captor.getAllValues().get(1).getSortObject(), is(expectedSortObject));
  }
View Full Code Here

    public void resolvesIndexDefinitionCorrectly() {

      List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(IndexOnLevelZero.class);

      IndexDefinition indexDefinition = indexDefinitions.get(0).getIndexDefinition();
      assertThat(indexDefinition.getIndexOptions(), equalTo(new BasicDBObjectBuilder().add("name", "indexedProperty")
          .get()));
    }
View Full Code Here

      List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(WithOptionsOnIndexedProperty.class);

      IndexDefinition indexDefinition = indexDefinitions.get(0).getIndexDefinition();
      assertThat(indexDefinition.getIndexOptions(),
          equalTo(new BasicDBObjectBuilder().add("name", "indexedProperty").add("unique", true).add("dropDups", true)
              .add("sparse", true).add("background", true).add("expireAfterSeconds", 10L).get()));
    }
View Full Code Here

TOP

Related Classes of com.mongodb.BasicDBObjectBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.