Esempio n. 1
0
        public MongoDbContext(string connectionstring, string databasename, string jobcollection)
        {
            Client       = new MongoClient(connectionstring);
            DatabaseBase = Client.GetDatabase(databasename);
            Students     = DatabaseBase.GetCollection <StudentModel>("Users");
            var indexModel = new CreateIndexModel <StudentModel>(Builders <StudentModel> .IndexKeys.Text(x => x.Tags));

            Students.Indexes.CreateOne(indexModel);
            Companies = DatabaseBase.GetCollection <CompanyModel>("Users");
            Jobs      = DatabaseBase.GetCollection <JobModel>(jobcollection);
        }