Advertisement

.net core3.1中使用 MongoDB.Driver 通过其API框架实现基础的增删改查功能,并支持分页查询

阅读量:

MongoDB.Driver基础操作

    • 模型
      • 增加、删除、修改与查询操作
        • 初始化集合:
        • 写入数据:
        • 查询数据:
        • 更新数据:
        • 删除数据:

在 .net core3.1 平台中,借助 MongoDB.Driver 工具实现对数据库的基本操作,包括数据的添加、删除、修改与查询功能,并支持分页处理。

模型

复制代码
    public class Person
    {
    public ObjectId Id { get; set; }
    //[BsonDateTimeOptions(Kind = DateTimeKind.Local)]
    public DateTime Created { get; set; }
    public string Title { get; set; }
    public string Description { get; set; }
    public string JumpUrl { get; set; }
    public int ReadingNum { get; set; }
    public PersonType Type { get; set; }
    }
    pu

全部评论 (0)

还没有任何评论哟~