本文整理汇总了Java中org.bson.Document.containsKey方法的典型用法代码示例。如果您正苦于以下问题:Java Document.containsKey方法的具体用法?Java Document.containsKey怎么用?Java Document.containsKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bson.Document
的用法示例。
在下文中一共展示了Document.containsKey方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setRSVPOptions
import org.bson.Document; //导入方法依赖的package包/类
/**
* Sets the mapping of emoji->rsvp_groups for a schedule
*/
public void setRSVPOptions(String cId, Map<String, String> options)
{
Document doc = Main.getDBDriver().getScheduleCollection().find(eq("_id", cId)).first();
if(!doc.containsKey("rsvp_options"))
{
doc.append("rsvp_options", options);
Main.getDBDriver().getScheduleCollection().replaceOne(eq("_id", cId), doc);
} else
{
Main.getDBDriver().getScheduleCollection().updateOne(eq("_id", cId), set("rsvp_options", options));
}
}
示例2: setRSVPClear
import org.bson.Document; //导入方法依赖的package包/类
/**
* Sets whether or not a schedule should add a 'clear all RSVPs' emoji reaction to events
*/
public void setRSVPClear(String cId, String emoji)
{
Document doc = Main.getDBDriver().getScheduleCollection().find(eq("_id", cId)).first();
if(!doc.containsKey("rsvp_clear"))
{
doc.append("rsvp_clear", emoji);
Main.getDBDriver().getScheduleCollection().replaceOne(eq("_id", cId), doc);
} else
{
Main.getDBDriver().getScheduleCollection().updateOne(eq("_id", cId), set("rsvp_clear", emoji));
}
}
示例3: setRSVPExclusivity
import org.bson.Document; //导入方法依赖的package包/类
/**
* Sets whether or not a schedule should allow users to RSVP for multiple group
*/
public void setRSVPExclusivity(String cId, Boolean bool)
{
Document doc = Main.getDBDriver().getScheduleCollection().find(eq("_id", cId)).first();
if(!doc.containsKey("rsvp_exclusivity"))
{
doc.append("rsvp_exclusivity", bool);
Main.getDBDriver().getScheduleCollection().replaceOne(eq("_id", cId), doc);
} else
{
Main.getDBDriver().getScheduleCollection().updateOne(eq("_id", cId), set("rsvp_exclusivity", bool));
}
}
示例4: setRSVPLoggingChannel
import org.bson.Document; //导入方法依赖的package包/类
/**
* Sets a schedule's channel to be used for RSVP logging
*/
public void setRSVPLoggingChannel(String cId, String channelIdentifier)
{
Document doc = Main.getDBDriver().getScheduleCollection().find(eq("_id", cId)).first();
if(!doc.containsKey("rsvp_logging"))
{
doc.append("rsvp_logging", channelIdentifier);
Main.getDBDriver().getScheduleCollection().replaceOne(eq("_id", cId), doc);
} else
{
Main.getDBDriver().getScheduleCollection().updateOne(eq("_id", cId), set("rsvp_logging", channelIdentifier));
}
}
示例5: addClassMethodsToBuilder
import org.bson.Document; //导入方法依赖的package包/类
/**
* genera i metodi di test per clazz
*
* @param classTestBuilder
* @param clazz
* @param prop
* @param mongo
*/
private void addClassMethodsToBuilder(Builder classTestBuilder, Class<?> clazz) {
int count = 0;
String appName = PropertiesUtils.getRequiredProperty(prop, PropertiesUtils.APP_NAME);
List<Document> methodInfo;
for (Method method : clazz.getDeclaredMethods()) {
Document methodInputs = null, methodOutput = null;
if (java.lang.reflect.Modifier.isPublic(method.getModifiers())) {
LOG.info("app: " + appName + " - method: " + method);
count++;
methodInfo = mongo.find(appName, method.toString());
for (Document doc : methodInfo) {
LOG.debug("document: " + doc);
if (doc.containsKey("argsBefore")) {
methodInputs = doc;
} else {
methodOutput = doc;
}
}
MethodSpec methodSpec = getMethodSpec(count, method, clazz, methodInputs, methodOutput);
classTestBuilder.addMethod(methodSpec);
}
}
classTestBuilder.addMethod(getDeserializeMethod(clazz));
}
示例6: setEndReminders
import org.bson.Document; //导入方法依赖的package包/类
/**
* Sets the time offsets for end reminders
*/
public void setEndReminders(String cId, List<Integer> reminders)
{
Document doc = Main.getDBDriver().getScheduleCollection().find(eq("_id", cId)).first();
if(!doc.containsKey("end_reminders"))
{
doc.append("end_reminders", reminders);
Main.getDBDriver().getScheduleCollection().replaceOne(eq("_id", cId), doc);
} else
{
Main.getDBDriver().getScheduleCollection().updateOne(eq("_id", cId), set("end_reminders", reminders));
}
}
示例7: setRSVPConfirmations
import org.bson.Document; //导入方法依赖的package包/类
/**
* Sets whether or not a schedule should notify users when they RSVP
*/
public void setRSVPConfirmations(String cId, Boolean bool)
{
Document doc = Main.getDBDriver().getScheduleCollection().find(eq("_id", cId)).first();
if(!doc.containsKey("rsvp_confirmations"))
{
doc.append("rsvp_confirmations", bool);
Main.getDBDriver().getScheduleCollection().replaceOne(eq("_id", cId), doc);
} else
{
Main.getDBDriver().getScheduleCollection().updateOne(eq("_id", cId), set("rsvp_confirmations", bool));
}
}
示例8: Save
import org.bson.Document; //导入方法依赖的package包/类
public void Save(Document doc) {
if (!doc.containsKey("_id")) {
Create(doc);
return;
}
Document find = new Document("_id", doc.get("_id"));
UpdateOptions uo = new UpdateOptions();
uo.upsert(true);
ops.add(new ReplaceOneModel<Document>(find, doc, uo));
FlushOpsIfFull();
}