Method EncryptExpression

| MongoDB CSharp Driver API Reference (original) (raw)

Namespace

MongoDB.Driver.Encryption

Assembly

MongoDB.Driver.Encryption.dll

EncryptExpression(BsonDocument, EncryptOptions, CancellationToken)

Encrypts a Match Expression or Aggregate Expression to query a range index.

public BsonDocument EncryptExpression(BsonDocument expression, EncryptOptions encryptOptions, CancellationToken cancellationToken = default)

Parameters

expression BsonDocument

The expression that is expected to be a BSON document of one of the following forms: 1. A Match Expression of this form: {$and: [{"field": {$gt: "value1"}}, {"field": {$lt: "value2" }}]} 2. An Aggregate Expression of this form: {$and: [{$gt: ["fieldpath", "value1"]}, {$lt: ["fieldpath", "value2"]}] gtmayalsobegt may also be gtmayalsobegte. ltmayalsobelt may also be ltmayalsobelte.

encryptOptions EncryptOptions

The encryption options.

cancellationToken CancellationToken

The cancellation token.

Returns

BsonDocument

The encrypted expression.