Examples of distinct()


Examples of com.mongodb.DBCollection.distinct()

        DBCollection collection = writeClient.getDB("testdb").getCollection("testcollection");
        collection.insert(new BasicDBObject("n", 1));
        collection.insert(new BasicDBObject("n", 2));
        collection.insert(new BasicDBObject("n", 1));
        collection = readOnlyClient.getDB("testdb").getCollection("testcollection");
        assertThat(collection.distinct("n")).containsExactly(1, 2);
    }

    @Test
    public void testInsert() throws Exception {
        DBCollection collection = readOnlyClient.getDB("testdb").getCollection("testcollection");
View Full Code Here

Examples of com.mongodb.DBCollection.distinct()

            {
                DBCollection dbc = db.getCollection( s );
                log.info( "getLayers; collection=" + dbc );
                // find distinct non-null geometry to determine if valid layer
                // TODO branch point for separate geometry-specific layers per collection
                List geoList = dbc.distinct( "geometry.type" );
                // distinct returns single BSON List, may barf if results large, > max doc. size
                // trap exception on props distinct and assume it's valid since there's obviously
                // something there (http://www.mongodb.org/display/DOCS/Aggregation)
                List propList = null;
                try
View Full Code Here

Examples of com.mongodb.DBCollection.distinct()

                // trap exception on props distinct and assume it's valid since there's obviously
                // something there (http://www.mongodb.org/display/DOCS/Aggregation)
                List propList = null;
                try
                {
                    propList = dbc.distinct( "properties" );
                }
                catch (IllegalArgumentException ex)
                {
                    propList = new BasicBSONList();
                    propList.add( "ex nihilo" );
View Full Code Here

Examples of com.mongodb.DBCollection.distinct()

  @SuppressWarnings("unchecked")
  public List<Object> distinct(String field) {
    assertValid();
    DBCollection col = db.getCollection(collection);
    return (readPreference!=null)
      ? col.distinct(field, toQueryObject(objectMapper), readPreference)
      : col.distinct(field, toQueryObject(objectMapper));
  }

  /**
   * Returns distinct values for the given field.  This field
View Full Code Here

Examples of com.mongodb.DBCollection.distinct()

  public List<Object> distinct(String field) {
    assertValid();
    DBCollection col = db.getCollection(collection);
    return (readPreference!=null)
      ? col.distinct(field, toQueryObject(objectMapper), readPreference)
      : col.distinct(field, toQueryObject(objectMapper));
  }

  /**
   * Returns distinct values for the given field.  This field
   * passed must be the name of a field on a MongoDB document.
View Full Code Here

Examples of com.mysema.query.jpa.impl.JPAQuery.distinct()

                .where((group.in(
                        adminOrganizationGroups.list(group))
                        .or(group.in(groupAdminDomains.list(domain.as(group.getClass()))))).and(getActiveOrganizationBooleanExpression(group.organization, user))
                );

        return mainQuery.distinct().list(group);
    }

    @Override
    public List<Group> getGroupsForUser(User user) {
        JPASubQuery userGroups = getAllGroupsForUser(user);
View Full Code Here

Examples of com.mysema.query.jpa.impl.JPAQuery.distinct()

        // Main query - All Groups which the user is a direct member (ROLE_GROUP_ADMIN or ROLE_GROUP_USER) or through organizations which the user is an admin (ROLE_ORG_ADMIN)
        JPAQuery mainQuery = cacheableQuery().from(group)
                .where(group.in(
                        userGroups.list(group)));

        return mainQuery.distinct().list(group);
    }

    @Override
    public List<Group> getGroupsForUserActiveOrganization(User user) {
        JPASubQuery userGroups = getAllGroupsForUser(user);
View Full Code Here

Examples of com.mysema.query.jpa.impl.JPAQuery.distinct()

        JPAQuery mainQuery = query().from(group)
                .join(group.organization, organization)
                .where(group.in(userGroups.list(group))
                        .and(getActiveOrganizationBooleanExpression(organization, user)));

        return mainQuery.distinct().list(group);
    }
}
View Full Code Here

Examples of com.mysema.query.jpa.impl.JPAQuery.distinct()

    public List<Application> getAllForUser(User user, ApplicationType... applicationTypes) {

        JPAQuery query = cacheableQuery().from(application)
                .where(getApplicationForUserBooleanExpression(user, applicationTypes));

        return query.distinct().list(application);
    }

    public void update(Application application) {
        getEntityManager().merge(application);
    }
View Full Code Here

Examples of com.mysema.query.jpa.impl.JPAQuery.distinct()

        QCat cat = QCat.cat;
        JPAQuery query = query().from(cat);

        query.count();
        assertProjectionEmpty(query);
        query.distinct().count();
        assertProjectionEmpty(query);

        query.iterate(cat);
        assertProjectionEmpty(query);
        query.iterate(cat,cat);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.