0
안녕하세요 저는 Mongo DB C#을 중심으로 CMS를 구축하기 시작했습니다. Mongo DB Nested 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
}
}
이 내 질문 난에 "콘텐츠"를 할 수 있도록 위의 변경 얼마나입니다 한 페이지에 여러 개의 콘텐츠 블록이 있기를 원할 때 목록이되어야합니다.
감사 괜찮 았는데. –