如果我不理解您的问题,您希望返回多个值以下代码块将帮助您
文档:http ://www.querydsl.com/static/querydsl/2.1.0/reference/html/ch02s07.html
JAVA
QMember qMember = new QMember("member");
MongodbQuery<Member> query = new MongodbQuery<Member>(morphia, datastore, qMember);
List<Member> members= query
.where(qMember.Name.eq("furkaan"))
.list();
.NET (C#)
mongodb.driver dll 2.4版
.Find() 扩展方法
命名空间:MongoDB.Driver.IMongoCollectionExtensions
public static Main(){
list<Member> members= Filter<Member>(x=>x.Name.Contains("furkaan","member"));
}
public static List<T> Filter<T>(Expression<Func<T, bool>> expressionFunc, string collectionName = null)
{
//var database = getDatabase() todo get database
List<T> results = new List<T>();
var collection = database.GetCollection<T>(collectionName);
if (collection != null)
{
results = collection.Find(expressionFunc).ToList();
}
return results;
}