0
嗨,我刚刚开始建立一个围绕Mongo DB c#的cms。Mongo DB嵌套的CRUD c#
我有一个看起来像这样为了简单起见这里删除了一些领域的基本文件......
{ "_id" : ObjectId("518438c35ea2e913ec41c138"), "Content" : "Some html content here", "Title" : "Robs Article", "Author" : "Rob Paddock", "DatePosted" : ISODate("0001-01-01T00:00:00Z"), "ArticleStatus" : "Live" }
要调用我有以下代码
public IEnumerable<Article> GetArticleDetails(int limit, int skip)
{
var articlesCursor = this.MongoConnectionHandler.MongoCollection.FindAllAs<Article>()
.SetSortOrder(SortBy<Article>.Descending(a => a.Title))
.SetLimit(limit)
.SetSkip(skip)
.SetFields(Fields<Article>.Include(a => a.Id, a => a.Title, a => a.Author));
return articlesCursor;
}
要创建一个新文档我有
public virtual void Create(T entity)
{
//// Save the entity with safe mode (WriteConcern.Acknowledged)
var result = this.MongoConnectionHandler.MongoCollection.Save(
entity,
new MongoInsertOptions
{
WriteConcern = WriteConcern.Acknowledged
});
if (!result.Ok)
{
//// Something went wrong
}
}
我的问题是我将如何改变上述允许“内容”以成为一个列表,因为我可能想在页面上有多个内容块。
由于工作的罚款。 – 2013-05-08 11:08:50