Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var projection = Builders<BsonDocument>.Projection.Include("title");
- db.books.aggregate(
- [
- {
- $project: {
- title: 1,
- lastName: "$author.lastName",
- }
- }
- ]
- )
- var project = new BsonDocument
- {
- {
- "$project",
- new BsonDocument
- {
- {"title", 1},
- {"lastName", "$author.lastName"},
- }
- }
- };
- var pipelineLast = new[] { project };
- var resultLast = db.books.Aggregate<BsonDocument>(pipelineLast);
- var matchingExamples = await resultLast.ToListAsync();
- foreach (var example in matchingExamples)
- {
- // Display the result
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement