我在使用Morphia的or()-方法时遇到麻烦。我使用了许多示例中所示的方法,但仍然出现错误。这是我的代码,我正在使用Morphia 1.3.2:
Query query = datastore.createQuery(Log.class);
query.or(
query.criteria("message").contains(searchTerm),
query.criteria("component").contains(searchTerm)
);
错误消息是:
Error:(34, 18) java: method or in interface org.mongodb.morphia.query.Query<T> cannot be applied to given types;
required: org.mongodb.morphia.query.Criteria[]
found: java.lang.Object,java.lang.Object
reason: varargs mismatch; java.lang.Object cannot be converted to org.mongodb.morphia.query.Criteria
我在做什么错了?