51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using MongoDB.Bson;
|
|
using MongoDB.Driver;
|
|
|
|
namespace LolDataRequestLib
|
|
{
|
|
class AtakhanRequest : ARequestData
|
|
{
|
|
protected override void requestDataMongoDB()
|
|
{
|
|
try
|
|
{
|
|
|
|
//var subFilterGameID = Builders<BsonDocument>.Filter.Eq("RequestGameID", DataManager.getInstance().mPlatformGameID);
|
|
|
|
var projection =
|
|
MongoDB.Bson.Serialization.BsonSerializer.Deserialize<BsonDocument>
|
|
("{'eventDocument.monsterName' : 1, 'eventDocument.sequenceIndex' : 1, 'eventDocument.gameTime' : 1}");
|
|
|
|
List<BsonDocument> documents = eventDataBase.GetCollection<BsonDocument>(this.mCollectionName)
|
|
.Find(new BsonDocument()) //.Find(subFilterGameID)
|
|
.SortByDescending(x => x["sequenceIndex"])
|
|
.Project(projection)
|
|
.ToList();
|
|
|
|
if (documents.Count == 0)
|
|
{
|
|
mUpdatedBsonValue = null;
|
|
return;
|
|
}
|
|
|
|
BsonDocument rtnValue = new BsonDocument();
|
|
|
|
foreach (BsonDocument item in documents)
|
|
{
|
|
rtnValue.Add(item["eventDocument"]["sequenceIndex"].ToString(), item["eventDocument"].ToBsonDocument());
|
|
}
|
|
rtnValue.Add("sequenceIndex", documents.First()["eventDocument"]["sequenceIndex"].ToInt32());
|
|
|
|
mUpdatedBsonValue = rtnValue;
|
|
}
|
|
catch (Exception ex) { }
|
|
}
|
|
}
|
|
}
|