Mongo C# driver - Contains Filter

In order to achieve that in V2 API, use the `Filter.Regex':

var collection = db.GetCollection<BsonDocument>("collection");

var filter = Builders<BsonDocument>.Filter.Regex("fieldName", new BsonRegularExpression(".*fieldValue.*"));

var data = await (await coll.FindAsync<BsonDocument>(filter).ConfigureAwait(false)).ToListAsync();

//continue process data 

If x is a string, you could do so with a simple regex. For the 2.0 driver, you can manually create the FilterDefinition:

FilterDefinition<BsonDocument> filter = "{ x : { $regex : /ABC/ } }";

Or build the filter use the Builder:

var builder = Builders<BsonDocument>.Filter;
var filter = builder.Matches("x", "ABC");

Then you can use the filter in your query:

using (var cursor = await collection.Find(filter).ToCursorAsync())
{
    // ...
}