Migration: Client Breaking Changes


The features listed on this page were available in former RavenDB versions.
In RavenDB 7.0, they are either unavailable or their behavior is inconsistent with their behavior in previous versions.


Subscription creation overload modification

  • In RavenDB versions earlier than 7.0, the Create<T> method overload that accepted a predicate also allowed specifying a query through SubscriptionCreationOptions, which could cause errors and confusion.
  • To eliminate this ambiguity, starting from 7.0, the Create<T> overload for predicate-based subscriptions now accepts PredicateSubscriptionCreationOptions, which no longer includes a Query property.
  • Refer to the Subscription creation API overview for the complete list of available Create method overloads.

// The create overload using a predicate:
// ======================================
string Create<T>(Expression<Func<T, bool>> predicate = null,
    PredicateSubscriptionCreationOptions options = null,
    string database = null);

Task<string> CreateAsync<T>(Expression<Func<T, bool>> predicate = null,
    PredicateSubscriptionCreationOptions options = null,
    string database = null,
    CancellationToken token = default);

// The options class:
// ==================
public sealed class PredicateSubscriptionCreationOptions
{
    public string Name { get; set; }
    public string ChangeVector { get; set; }
    public string MentorNode { get; set; }
    public bool Disabled { get; set; }
    public bool PinToMentorNode { get; set; }
    public ArchivedDataProcessingBehavior? ArchivedDataProcessingBehavior { get; set; }
}
// The create overload using a predicate:
// ======================================
string Create<T>(Expression<Func<T, bool>> predicate = null,
    SubscriptionCreationOptions options = null,
    string database = null);

Task<string> CreateAsync<T>(Expression<Func<T, bool>> predicate = null,
    SubscriptionCreationOptions options = null,
    string database = null,
    CancellationToken token = default);

// The options class:
// ==================
public class SubscriptionCreationOptions
{
    public string Name { get; set; }
    public string Query { get; set; }
    public string ChangeVector { get; set; }
    public string MentorNode { get; set; }
    public virtual bool Disabled { get; set; }
    public virtual bool PinToMentorNode { get; set; }
    public ArchivedDataProcessingBehavior? ArchivedDataProcessingBehavior { get; set; }
}

HTTP-Compression algorithm is now Zstd by default

From RavenDB 7.0 on, the default HTTP compression algorithm is Zstd (instead of Gzip, used in earlier versions).

To switch the HTTP-compression algorithm:

Clients can switch to a different HTTP-Compression algorithm using DocumentStore's DocumentConventions.HttpCompressionAlgorithm convention.

var DocumentConventions = new DocumentConventions
{
    // Switch HTTP compression algorithm
    HttpCompressionAlgorithm = HttpCompressionAlgorithm.Gzip
};

If you migrate from an earlier RavenDB version to version 7.0 or higher,
please note the potential significance of this change.

Bulk-insert Compression is now Enabled by default

Compression is now Enabled by default for bulk-insert operations.

CompressionLevel DefaultCompressionLevel = CompressionLevel.Fastest;

To switch the bulk-insert state:

Clients can switch to a different bulk-insert compression state using Store's BulkInsertOptions.CompressionLevel option.

using (var bulk = store.BulkInsert(new BulkInsertOptions
{
    // Disable bulk-insert compression
    CompressionLevel = CompressionLevel.NoCompression
}));

Removed irrelevant SingleNodeBatchCommand parameters

We removed from SingleNodeBatchCommand's definition the parameters that are mainly used internally and kept only those relevant to the user.

SingleNodeBatchCommand signature:

public SingleNodeBatchCommand
    (DocumentConventions conventions, 
     IList<ICommandData> commands, 
     BatchOptions options = null)
public SingleNodeBatchCommand
    (DocumentConventions conventions, 
     JsonOperationContext context, 
     IList<ICommandData> commands, 
     BatchOptions options = null, 
     TransactionMode mode = TransactionMode.SingleNode)

Removed obsolete methods

The following methods are no longer used and have been removed from RavenDB 7.0.

  • NextPageStart

    public int NextPageStart { get; set; }
  • GenerateEntityIdOnTheClient

    public GenerateEntityIdOnTheClient(DocumentConventions conventions,
                                          Func<object, string> generateId)
  • InMemoryDocumentSessionOperations.GenerateId

    protected override string GenerateId(object entity)
  • InMemoryDocumentSessionOperations.GetOrGenerateDocumentIdAsync

    protected async Task<string> GetOrGenerateDocumentIdAsync(object entity)

FromEtl is now internal

The CounterBatch class FromEtl property is now internal.
FromEtl is used internally to get or set a value indicating whether a counters batch originated from an ETL process.

Do you need any help with Migration?