« Mongodb and csharp » : différence entre les versions

De Banane Atomic
Aller à la navigationAller à la recherche
(Page créée avec « Category:.NET = Filter = <kode lang='cs'> var builder = Builders<MyClass>.Filter; var filter = builder.In(x => x.Property1, Ids); // filter by Property1 in the Ids list </kode> »)
 
Aucun résumé des modifications
Ligne 1 : Ligne 1 :
[[Category:.NET]]
[[Category:.NET]]
= Access to a collection =
<kode lang='cs'>
var mongoClient = new MongoClient("MONGODB_CONNECTION_STRING");
var collection = mongoClient.GetDatabase("DB_NAME").GetCollection<Collection>("COLLECTION_NAME");
</kode>
= Filter =
= Filter =
<kode lang='cs'>
<kode lang='cs'>

Version du 15 mars 2024 à 16:18

Access to a collection

Cs.svg
var mongoClient = new MongoClient("MONGODB_CONNECTION_STRING");
var collection = mongoClient.GetDatabase("DB_NAME").GetCollection<Collection>("COLLECTION_NAME");

Filter

Cs.svg
var builder = Builders<MyClass>.Filter;
var filter = builder.In(x => x.Property1, Ids); // filter by Property1 in the Ids list