Driver 3.x:Project with Builders<BsonDocument>.Projection.Expression will add $literal

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Gone away
    • Priority: Unknown
    • None
    • Affects Version/s: 3.0.0
    • Component/s: None
    • None
    • None
    • Dotnet Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Summary

      Mongodb Driver c# 3.x,when aggregate with Builders<BsonDocument>.Projection.Expression, the final pipeline will add $literal operator, which not in 2.28.0.

      Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).

      How to Reproduce

      1. Create a Projection
            var projection = Builders<BsonDocument>.Projection.Expression(document => new
                {
                    Number = new BsonDocument("$toDouble", new BsonDocument "$substr", new BsonArray {$"${numberFiled}", prefix.Length, -1}),
                    Id = document["_id"]
                });
      2.  Aggregate with it

      dbSet.Aggregate().Project(projection)

      Additional Background

      Please provide any additional background information that may be helpful in diagnosing the bug.

            Assignee:
            Oleksandr Poliakov
            Reporter:
            Dong Cheng
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: