Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

MongoDB .NET Driver - Aliasing fields in the projection

$
0
0

How to add alias in .NET 8 Blazor C# to change the field name?

var project = Builders<BsonDocument>.Projection.Include("NameField").Include("_id")

How can I change the name NameField to just Name?

var client = new MongoClient();var db = client.GetDatabase("DB");var coll = db.GetCollection<BsonDocument>("CollectionName");var filter = Builders<BsonDocument>.Filter.Eq("_id", id);var query = coll.Find(filter);

How can I use the alias in this code?

Any guidance or suggestions would be greatly appreciated.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>