コード例 #1
0
        public async Task CreateIndexTest()
        {
            //创建复合索引
            await _mongo.CreateOneIndexAsync("persons", new Dictionary <string, SortDirection>
            {
                ["ClassId"]  = SortDirection.Ascending,
                ["CameraId"] = SortDirection.Ascending
            });

            //创建多个单索引
            await _mongo.CreateManyIndexAsync(_collection, new Dictionary <string, SortDirection>
            {
                ["FaceId"]   = SortDirection.Ascending,
                ["UserName"] = SortDirection.Ascending
            });
        }