Exception:
System.FormatException: Invalid JSON number '2L'.
at MongoDB.Bson.IO.JsonScanner.GetNumberToken(JsonBuffer buffer, Int32 firstChar)
at MongoDB.Bson.IO.JsonScanner.GetNextToken(JsonBuffer buffer)
at MongoDB.Bson.IO.JsonReader.PopToken()
at MongoDB.Bson.IO.JsonReader.ReadBsonType()
at MongoDB.Bson.Serialization.Serializers.BsonDocumentSerializer.DeserializeValue(BsonDeserializationContext context, BsonDeserializationArgs args)
Shard key definition, which is a composite key created by the constructor;
public string ShardKey { get; set; }
Query code:
public virtual async Task<ICollection<City>>(City city)
{
string shardKey = city.CityNumber + city.ShortName;
return await MongoDb.CitiesCollection.Aggregate().Match({
"{ 'Time': { $elemMatch: { $eq: 0 } }," + " ShardKey: " + shardKey + " }")
.ToListAsync();
}
Why does this fail?