mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-20 18:48:09 +08:00
Update mongodb
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Serializers;
|
||||
using MongoDB.Driver;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Text;
|
||||
|
||||
namespace MongoDb.Ado.data
|
||||
{
|
||||
public class DbDataReaderFactory
|
||||
{
|
||||
public DbDataReader Handle(string operation, IMongoCollection<BsonDocument> collection, string json)
|
||||
{
|
||||
var doc = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<BsonValue>(json);
|
||||
IQueryHandler queryHandler = null;
|
||||
if (operation == "find")
|
||||
{
|
||||
queryHandler = new QueryFindHandler();
|
||||
}
|
||||
else if (operation == "aggregate")
|
||||
{
|
||||
queryHandler = new QueryAggregateHandler();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException($" NotSupportedException: {operation} ");
|
||||
}
|
||||
return queryHandler.Find(collection, doc);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user