當前位置: 首頁>>代碼示例>>Java>>正文


Java Filters.and方法代碼示例

本文整理匯總了Java中com.mongodb.client.model.Filters.and方法的典型用法代碼示例。如果您正苦於以下問題:Java Filters.and方法的具體用法?Java Filters.and怎麽用?Java Filters.and使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.mongodb.client.model.Filters的用法示例。


在下文中一共展示了Filters.and方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: between

import com.mongodb.client.model.Filters; //導入方法依賴的package包/類
default Bson between() {
    return Filters.and(
            Filters.gte("millis", millis()[0]),
            Filters.lte("millis", millis()[1])
    );
}
 
開發者ID:sip3io,項目名稱:tapir,代碼行數:7,代碼來源:Query.java

示例2: filter

import com.mongodb.client.model.Filters; //導入方法依賴的package包/類
@Override
public Bson filter() {
    List<Bson> filters = Stream.of(
            between(),
            filter("caller", caller),
            filter("callee", callee)
    ).filter(Objects::nonNull).collect(Collectors.toList());

    return Filters.and(filters);
}
 
開發者ID:sip3io,項目名稱:tapir,代碼行數:11,代碼來源:SipSearchQuery.java

示例3: filter

import com.mongodb.client.model.Filters; //導入方法依賴的package包/類
@Override
public Bson filter() {
    return Filters.and(
            between(),
            Filters.in("call_id", callIds)
    );
}
 
開發者ID:sip3io,項目名稱:tapir,代碼行數:8,代碼來源:SipSessionQuery.java

示例4: and

import com.mongodb.client.model.Filters; //導入方法依賴的package包/類
/**
 * 與操作
 *
 * @param queries
 * @return
 */
public static MongodbQuery and(MongodbQuery... queries) {
    List<Bson> queryList = new ArrayList<Bson>();
    for (MongodbQuery query : queries) {
        if (query != null && query.getQuery() != null) {
            queryList.add(query.getQuery());
        }
    }
    return new MongodbQuery(Filters.and(queryList));
}
 
開發者ID:wxz1211,項目名稱:dooo,代碼行數:16,代碼來源:MongodbQuery.java

示例5: testDeleteById

import com.mongodb.client.model.Filters; //導入方法依賴的package包/類
@Test
public void testDeleteById() {
	TestMongo testMongo = new TestMongo("222", "name");
	boolean result = MongodbManager.insertOne("test_table", testMongo);
	Bson filter = Filters.and(Filters.eq("id", "222"));
	List<TestMongo> list = MongodbManager.find("test_table", filter, TestMongo.class, 0, 0);
	testMongo = list.get(0);
	result = MongodbManager.deleteById("test_table", testMongo);
	assertEquals(true, result);
}
 
開發者ID:dianbaer,項目名稱:grain,代碼行數:11,代碼來源:MongodbManagerTest.java

示例6: testUpdateById

import com.mongodb.client.model.Filters; //導入方法依賴的package包/類
@Test
public void testUpdateById() {
	TestMongo testMongo = new TestMongo("333", "name");
	boolean result = MongodbManager.insertOne("test_table", testMongo);
	Bson filter = Filters.and(Filters.eq("id", "333"));
	List<TestMongo> list = MongodbManager.find("test_table", filter, TestMongo.class, 0, 0);
	testMongo = list.get(0);
	testMongo.setName("name" + UUID.randomUUID().toString());
	result = MongodbManager.updateById("test_table", testMongo);
	assertEquals(true, result);
}
 
開發者ID:dianbaer,項目名稱:grain,代碼行數:12,代碼來源:MongodbManagerTest.java

示例7: getChatList

import com.mongodb.client.model.Filters; //導入方法依賴的package包/類
public static List<ChatObj> getChatList(String fromUserId, String toTypeId, int chatType) {
	Bson filter = Filters.and(Filters.eq(ChatObj.FROM_USER_ID, fromUserId), Filters.eq(ChatObj.CHAT_TYPE, chatType));
	List<ChatObj> list = MongodbManager.find(getUserToUserCollectionName(fromUserId, toTypeId), filter, ChatObj.class, 0, 0);
	return list;
}
 
開發者ID:dianbaer,項目名稱:anychat,代碼行數:6,代碼來源:ChatActionMongodb.java

示例8: get

import com.mongodb.client.model.Filters; //導入方法依賴的package包/類
@Override
public Bson get() {
  List<Predicate> predicates = getPredicates();

  List<Bson> filters = Lists.newArrayListWithExpectedSize(predicates.size());
  for (Predicate predicate : predicates) {
    if (predicate.isEquals()) {
      filters.add(Filters.eq(predicate.getLhs(), toOperand(predicate.getRhs().get(0))));
    } else if (predicate.isNotEquals()) {
      filters.add(Filters.ne(predicate.getLhs(), toOperand(predicate.getRhs().get(0))));
    } else if (predicate.isGreaterThan()) {
      filters.add(Filters.gt(predicate.getLhs(), toOperand(predicate.getRhs().get(0))));
    } else if (predicate.isGreaterThanOrEqualTo()) {
      filters.add(Filters.gte(predicate.getLhs(), toOperand(predicate.getRhs().get(0))));
    } else if (predicate.isLessThan()) {
      filters.add(Filters.lt(predicate.getLhs(), toOperand(predicate.getRhs().get(0))));
    } else if (predicate.isLessThanOrEqualTo()) {
      filters.add(Filters.lte(predicate.getLhs(), toOperand(predicate.getRhs().get(0))));
    } else if (predicate.isBetween()) {
      // 'x between 5 and 10' _generally_ means: x >= 5 and x < 10
      filters.add(Filters.gte(predicate.getLhs(), toOperand(predicate.getRhs().get(0))));
      filters.add(Filters.lt(predicate.getLhs(), toOperand(predicate.getRhs().get(1))));
    } else if (predicate.isIn()) {
      filters.add(Filters.in(predicate.getLhs(), toOperands(predicate.getRhs())));
    } else if (predicate.isNotIn()) {
      filters.add(Filters.nin(predicate.getLhs(), toOperands(predicate.getRhs())));
    } else if (predicate.isLike()) {
      filters.add(Filters.regex(predicate.getLhs(), toRegex(predicate.getRhs().get(0))));
    } else if (predicate.isNotLike()) {
      filters.add(
          Filters.not(Filters.regex(predicate.getLhs(), toRegex(predicate.getRhs().get(0)))));
    } else if (predicate.isNull()) {
      filters.add(Filters.eq(predicate.getLhs(), null));
    } else if (predicate.isNotNull()) {
      filters.add(Filters.ne(predicate.getLhs(), null));
    }
  }
  if (filters.isEmpty()) {
    // this is the no-op case
    return new BsonDocument();
  } else {
    return Filters.and(filters.toArray(new Bson[filters.size()]));
  }
}
 
開發者ID:glytching,項目名稱:dragoman,代碼行數:45,代碼來源:MongoWhereClauseListener.java

示例9: filter

import com.mongodb.client.model.Filters; //導入方法依賴的package包/類
private Bson filter(String name, String hashedPassword) {
  return Filters.and(Filters.eq("name", name), Filters.eq("hashedPassword", hashedPassword));
}
 
開發者ID:glytching,項目名稱:dragoman,代碼行數:4,代碼來源:MongoAuthenticationDao.java


注:本文中的com.mongodb.client.model.Filters.and方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。