@mastra/mongodb 1.18.9-alpha.1 → 1.18.9-alpha.2

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.
@@ -3,7 +3,7 @@ name: mastra-mongodb
3
3
  description: Documentation for @mastra/mongodb. Use when working with @mastra/mongodb APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/mongodb"
6
- version: "1.18.9-alpha.1"
6
+ version: "1.18.9-alpha.2"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.18.9-alpha.1",
2
+ "version": "1.18.9-alpha.2",
3
3
  "package": "@mastra/mongodb",
4
4
  "exports": {},
5
5
  "modules": {}
package/dist/index.cjs CHANGED
@@ -10,7 +10,7 @@ let _mastra_core_agent = require("@mastra/core/agent");
10
10
  let _mastra_core_evals = require("@mastra/core/evals");
11
11
  let _mastra_core_storage_domains_skills = require("@mastra/core/storage/domains/skills");
12
12
  //#region package.json
13
- var version = "1.18.9-alpha.1";
13
+ var version = "1.18.9-alpha.2";
14
14
  //#endregion
15
15
  //#region src/vector/filter.ts
16
16
  /**
@@ -2961,6 +2961,14 @@ var MongoDBDatasetsStorage = class extends _mastra_core_storage.DatasetsStorage
2961
2961
  }
2962
2962
  async listDatasets(args) {
2963
2963
  try {
2964
+ const orderBy = (0, _mastra_core_storage.resolveListOrderBy)(args.orderBy, [
2965
+ "createdAt",
2966
+ "updatedAt",
2967
+ "name"
2968
+ ], {
2969
+ field: "createdAt",
2970
+ direction: "DESC"
2971
+ });
2964
2972
  const { page, perPage: perPageInput } = args.pagination;
2965
2973
  const collection = await this.getCollection(_mastra_core_storage.TABLE_DATASETS);
2966
2974
  const filter = {};
@@ -2998,7 +3006,7 @@ var MongoDBDatasetsStorage = class extends _mastra_core_storage.DatasetsStorage
2998
3006
  const limitValue = perPageInput === false ? total : perPage;
2999
3007
  return {
3000
3008
  datasets: (await collection.find(filter).sort({
3001
- createdAt: -1,
3009
+ [orderBy.field]: orderBy.direction === "DESC" ? -1 : 1,
3002
3010
  id: 1
3003
3011
  }).skip(offset).limit(limitValue).toArray()).map((row) => this.transformDatasetRow(row)),
3004
3012
  pagination: {
@@ -3608,6 +3616,10 @@ var MongoDBDatasetsStorage = class extends _mastra_core_storage.DatasetsStorage
3608
3616
  }
3609
3617
  async listItems(args) {
3610
3618
  try {
3619
+ const orderBy = (0, _mastra_core_storage.resolveListOrderBy)(args.orderBy, ["createdAt", "updatedAt"], {
3620
+ field: "createdAt",
3621
+ direction: "DESC"
3622
+ });
3611
3623
  const { page, perPage: perPageInput } = args.pagination;
3612
3624
  const collection = await this.getCollection(_mastra_core_storage.TABLE_DATASET_ITEMS);
3613
3625
  const filter = { datasetId: args.datasetId };
@@ -3663,7 +3675,7 @@ var MongoDBDatasetsStorage = class extends _mastra_core_storage.DatasetsStorage
3663
3675
  const limitValue = perPageInput === false ? total : perPage;
3664
3676
  return {
3665
3677
  items: (await collection.find(filter).sort({
3666
- createdAt: -1,
3678
+ [orderBy.field]: orderBy.direction === "DESC" ? -1 : 1,
3667
3679
  id: 1
3668
3680
  }).skip(offset).limit(limitValue).toArray()).map((row) => this.transformItemRow(row)),
3669
3681
  pagination: {
@@ -4135,6 +4147,10 @@ var MongoDBExperimentsStorage = class MongoDBExperimentsStorage extends _mastra_
4135
4147
  }
4136
4148
  async listExperiments(args) {
4137
4149
  try {
4150
+ const orderBy = (0, _mastra_core_storage.resolveListOrderBy)(args.orderBy, ["createdAt", "status"], {
4151
+ field: "createdAt",
4152
+ direction: "DESC"
4153
+ });
4138
4154
  const collection = await this.getCollection(_mastra_core_storage.TABLE_EXPERIMENTS);
4139
4155
  const { page, perPage: perPageInput } = args.pagination;
4140
4156
  const filter = {};
@@ -4176,7 +4192,7 @@ var MongoDBExperimentsStorage = class MongoDBExperimentsStorage extends _mastra_
4176
4192
  const limitValue = perPageInput === false ? total : normalizedPerPage;
4177
4193
  return {
4178
4194
  experiments: (await collection.find(filter).sort({
4179
- createdAt: -1,
4195
+ [orderBy.field]: orderBy.direction === "DESC" ? -1 : 1,
4180
4196
  id: 1
4181
4197
  }).skip(offset).limit(limitValue).toArray()).map((d) => transformExperimentRow(d)),
4182
4198
  pagination: {
@@ -4375,6 +4391,10 @@ var MongoDBExperimentsStorage = class MongoDBExperimentsStorage extends _mastra_
4375
4391
  }
4376
4392
  async listExperimentResults(args) {
4377
4393
  try {
4394
+ const orderBy = (0, _mastra_core_storage.resolveListOrderBy)(args.orderBy, ["startedAt", "createdAt"], {
4395
+ field: "startedAt",
4396
+ direction: "ASC"
4397
+ });
4378
4398
  const collection = await this.getCollection(_mastra_core_storage.TABLE_EXPERIMENT_RESULTS);
4379
4399
  const { page, perPage: perPageInput } = args.pagination;
4380
4400
  const filter = { experimentId: args.experimentId };
@@ -4410,7 +4430,7 @@ var MongoDBExperimentsStorage = class MongoDBExperimentsStorage extends _mastra_
4410
4430
  const limitValue = perPageInput === false ? total : normalizedPerPage;
4411
4431
  return {
4412
4432
  results: (await collection.find(filter).sort({
4413
- startedAt: 1,
4433
+ [orderBy.field]: orderBy.direction === "DESC" ? -1 : 1,
4414
4434
  id: 1
4415
4435
  }).skip(offset).limit(limitValue).toArray()).map((d) => transformExperimentResultRow(d)),
4416
4436
  pagination: {