@atscript/db-mongo 0.1.152 → 0.1.153

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -254,6 +254,14 @@ interface TMongoAdapterOptions {
254
254
  * Default: exact counts.
255
255
  */
256
256
  estimatedCount?: boolean | readonly string[];
257
+ /**
258
+ * Read a managed view through its own pipeline on the entry collection,
259
+ * without the `$lookup` + `$unwind` stages of the joins the read does not
260
+ * need (default `true`) — see the views guide, "Performance". `false`
261
+ * always reads the stored view.
262
+ * @since 0.1.153
263
+ */
264
+ viewJoinPruning?: boolean;
257
265
  }
258
266
  declare class MongoAdapter extends BaseDbAdapter {
259
267
  protected readonly db: Db;
@@ -339,6 +347,12 @@ declare class MongoAdapter extends BaseDbAdapter {
339
347
  aggregateFns(): ReadonlySet<AggregateFn>;
340
348
  /** Arithmetic in an aggregate `$select` (`{ $expr }`, `{ $fn, $expr }`). */
341
349
  supportsAggregateExpressions(): boolean;
350
+ /**
351
+ * `$nulls` placement (since 0.1.153): a placed `$sort` / `$rowOrder` key
352
+ * gets a null-or-missing flag ordered before it (`mongo-sort.ts`) — reads
353
+ * then run as a pipeline with a blocking sort instead of `find().sort()`.
354
+ */
355
+ supportsNullsPlacement(): boolean;
342
356
  /** Computed view columns and first-row joins. */
343
357
  viewCapabilities(): ReadonlySet<TViewCapability>;
344
358
  /**
@@ -600,7 +614,29 @@ declare class MongoAdapter extends BaseDbAdapter {
600
614
  private _getCurrentFieldMax;
601
615
  /** Allocates increment values for a batch of items, assigning in order. */
602
616
  private _assignBatchIncrements;
603
- /** A find whose filter holds relational predicates, as an aggregation pipeline. */
617
+ /**
618
+ * The pruned read of this adapter's managed view for `query` followed by
619
+ * `stages` (`mongoViewRead`, since 0.1.153): the view pipeline without the
620
+ * joins the read does not need, on the entry collection — or `undefined`
621
+ * to read the stored view: pruning off, not a view, nothing droppable, an
622
+ * operation-wide collation (it would govern the view's join keys too), or
623
+ * stages that may read a dropped column ({@link stagesReadAny}).
624
+ */
625
+ private _viewRead;
626
+ /**
627
+ * Runs a read pipeline — through the pruned view read `pruned` when there
628
+ * is one, on the bound collection otherwise. A view's own default
629
+ * collation is the simple one, so the pruned read pins it: the entry
630
+ * collection's default must not apply.
631
+ */
632
+ private _readPipeline;
633
+ /** A find over the pruned view read, or `undefined` when the stored view is read. */
634
+ private _prunedFind;
635
+ /**
636
+ * A find as an aggregation pipeline: its filter holds relational
637
+ * predicates, or its `$sort` places NULL (`$nulls` — `find().sort()` cannot
638
+ * express it; the placed sort is a blocking sort, so it may spill to disk).
639
+ */
604
640
  private _aggregateFind;
605
641
  private _buildFindOptions;
606
642
  /**
package/dist/index.d.mts CHANGED
@@ -254,6 +254,14 @@ interface TMongoAdapterOptions {
254
254
  * Default: exact counts.
255
255
  */
256
256
  estimatedCount?: boolean | readonly string[];
257
+ /**
258
+ * Read a managed view through its own pipeline on the entry collection,
259
+ * without the `$lookup` + `$unwind` stages of the joins the read does not
260
+ * need (default `true`) — see the views guide, "Performance". `false`
261
+ * always reads the stored view.
262
+ * @since 0.1.153
263
+ */
264
+ viewJoinPruning?: boolean;
257
265
  }
258
266
  declare class MongoAdapter extends BaseDbAdapter {
259
267
  protected readonly db: Db;
@@ -339,6 +347,12 @@ declare class MongoAdapter extends BaseDbAdapter {
339
347
  aggregateFns(): ReadonlySet<AggregateFn>;
340
348
  /** Arithmetic in an aggregate `$select` (`{ $expr }`, `{ $fn, $expr }`). */
341
349
  supportsAggregateExpressions(): boolean;
350
+ /**
351
+ * `$nulls` placement (since 0.1.153): a placed `$sort` / `$rowOrder` key
352
+ * gets a null-or-missing flag ordered before it (`mongo-sort.ts`) — reads
353
+ * then run as a pipeline with a blocking sort instead of `find().sort()`.
354
+ */
355
+ supportsNullsPlacement(): boolean;
342
356
  /** Computed view columns and first-row joins. */
343
357
  viewCapabilities(): ReadonlySet<TViewCapability>;
344
358
  /**
@@ -600,7 +614,29 @@ declare class MongoAdapter extends BaseDbAdapter {
600
614
  private _getCurrentFieldMax;
601
615
  /** Allocates increment values for a batch of items, assigning in order. */
602
616
  private _assignBatchIncrements;
603
- /** A find whose filter holds relational predicates, as an aggregation pipeline. */
617
+ /**
618
+ * The pruned read of this adapter's managed view for `query` followed by
619
+ * `stages` (`mongoViewRead`, since 0.1.153): the view pipeline without the
620
+ * joins the read does not need, on the entry collection — or `undefined`
621
+ * to read the stored view: pruning off, not a view, nothing droppable, an
622
+ * operation-wide collation (it would govern the view's join keys too), or
623
+ * stages that may read a dropped column ({@link stagesReadAny}).
624
+ */
625
+ private _viewRead;
626
+ /**
627
+ * Runs a read pipeline — through the pruned view read `pruned` when there
628
+ * is one, on the bound collection otherwise. A view's own default
629
+ * collation is the simple one, so the pruned read pins it: the entry
630
+ * collection's default must not apply.
631
+ */
632
+ private _readPipeline;
633
+ /** A find over the pruned view read, or `undefined` when the stored view is read. */
634
+ private _prunedFind;
635
+ /**
636
+ * A find as an aggregation pipeline: its filter holds relational
637
+ * predicates, or its `$sort` places NULL (`$nulls` — `find().sort()` cannot
638
+ * express it; the placed sort is a blocking sort, so it may spill to disk).
639
+ */
604
640
  private _aggregateFind;
605
641
  private _buildFindOptions;
606
642
  /**