Unable to cast object of type 'MongoDB.Bson.Serialization.Serializers.GuidSerializer' to type 'MongoDB.Bson.Serialization.IBsonSerializer`1[System.Nullable`1[System.Guid]]'.

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Won't Fix
    • Priority: Minor - P4
    • None
    • Affects Version/s: 2.2.3
    • Component/s: BSON
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When attempting to map to a guid within an Elem match, we are getting the above exception.

      Example code:

      Unable to find source-code formatter for language: csharp. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
                  var elemFilters = new List<FilterDefinition<SPI>>
                  {
                      Builders<SPI>.Filter.Regex("ST", BuildRegex("^" + Regex.Escape(shortText) + "$"))
                  };
                  if (ignoreGuid.HasValue)
                  {
                      elemFilters.Add(Builders<SPI>.Filter.Ne(q => q.Guid, ignoreGuid));
                  }
      
                  var query = Builders<AP>.Filter.And(
                          Builders<AP>.Filter.Eq(p => p.AppId, appId),
                          Builders<AP>.Filter.ElemMatch(p => p.Items, Builders<SPI>.Filter.And(elemFilters))
                      );
      
               Collection.Find(query).Any() // <--- error happens here
      
      

            Assignee:
            Unassigned
            Reporter:
            Chad Kreimendahl
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: