Olá.
Quero apagar um elemento de um array de string, no caso é o array Profiles, que esta presente no Documento Person.
Isto numa aplicação desenvolvida em .net e com mongodb driver.
Exemplo de um documento na coleção:
{"_id":{"$oid":"5e285ff7ac033a913ca37a0c"},"PersonId":{"$numberInt":"7"},"Profiles":["profile1","profile2","profile3"],"CreatedDate":{"$date":{"$numberLong":"1579703399301"}},"UpdatedDate":{"$date":{"$numberLong":"1579703399301"}}}
E o código para remover do array em c#:
var update = Builders<Person>.Update.PullFilter(
c => c.Profiles,
s => s == "profile1");
await this.DBset.FindOneAndUpdateAsync(c => c.PersonId == personId, update).ConfigureAwait(false);
Está a ser retornado o seguinte erro:
System.InvalidOperationException: '{document} is not supported.'
MongoDB.Driver.Linq.Translators.PredicateTranslator.GetFieldExpression(System.Linq.Expressions.Expression)
MongoDB.Driver.Linq.Translators.PredicateTranslator.TranslateComparison(System.Linq.Expressions.Expression, System.Linq.Expressions.ExpressionType, System.Linq.Expressions.ConstantExpression)
MongoDB.Driver.Linq.Translators.PredicateTranslator.Translate(System.Linq.Expressions.Expression)
MongoDB.Driver.Linq.Translators.PredicateTranslator.Translate(System.Linq.Expressions.Expression, MongoDB.Bson.Serialization.IBsonSerializerRegistry)
MongoDB.Driver.MongoCollectionImpl<TDocument>.UsingImplicitSessionAsync<TResult>(System.Func<MongoDB.Driver.IClientSessionHandle, System.Threading.Tasks.Task<TResult>>, System.Threading.CancellationToken)
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Alguma ideia do que possa ser?
Obrigado.