@dnax/core 0.8.3 → 0.8.5
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/lib/collection.ts +35 -17
- package/package.json +1 -1
package/lib/collection.ts
CHANGED
|
@@ -91,7 +91,12 @@ async function syncCollectionDatabase() {
|
|
|
91
91
|
await t.database.db?.createCollection(c.slug);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
var allIndexes = await t.database.db
|
|
94
|
+
var allIndexes = await t.database.db
|
|
95
|
+
?.collection(c.slug)
|
|
96
|
+
.indexes()
|
|
97
|
+
.catch((err) => {
|
|
98
|
+
console.error(err?.message);
|
|
99
|
+
});
|
|
95
100
|
|
|
96
101
|
// console.log('Allindex',allIndexes)
|
|
97
102
|
|
|
@@ -112,7 +117,10 @@ async function syncCollectionDatabase() {
|
|
|
112
117
|
if (!findexIndexKey)
|
|
113
118
|
await t.database.db
|
|
114
119
|
?.collection(c?.slug)
|
|
115
|
-
.dropIndex(dbIndex?.name as string)
|
|
120
|
+
.dropIndex(dbIndex?.name as string)
|
|
121
|
+
.catch((err) => {
|
|
122
|
+
console.error(err?.message);
|
|
123
|
+
});
|
|
116
124
|
}
|
|
117
125
|
|
|
118
126
|
//console.log(t.database.db);
|
|
@@ -120,7 +128,10 @@ async function syncCollectionDatabase() {
|
|
|
120
128
|
await t.database.db
|
|
121
129
|
?.collection(c.slug)
|
|
122
130
|
.createIndex(["createdAt", "updatedAt"])
|
|
123
|
-
.then((e) => {})
|
|
131
|
+
.then((e) => {})
|
|
132
|
+
.catch((err) => {
|
|
133
|
+
console.error(err?.message);
|
|
134
|
+
});
|
|
124
135
|
|
|
125
136
|
// 3- suppression des indexes
|
|
126
137
|
//
|
|
@@ -132,7 +143,9 @@ async function syncCollectionDatabase() {
|
|
|
132
143
|
.dropIndex({
|
|
133
144
|
[f.name]: 1,
|
|
134
145
|
})
|
|
135
|
-
.catch()
|
|
146
|
+
.catch((err) => {
|
|
147
|
+
console.error(err?.message);
|
|
148
|
+
});
|
|
136
149
|
}
|
|
137
150
|
});
|
|
138
151
|
|
|
@@ -176,19 +189,24 @@ async function syncCollectionDatabase() {
|
|
|
176
189
|
});
|
|
177
190
|
}
|
|
178
191
|
|
|
179
|
-
await t.database.db
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
+
await t.database.db
|
|
193
|
+
?.collection(c.slug)
|
|
194
|
+
.createIndex(
|
|
195
|
+
{
|
|
196
|
+
...omit(index, ["sparse", "unique", "expireAfterSeconds"]),
|
|
197
|
+
},
|
|
198
|
+
//@ts-expect-error
|
|
199
|
+
{
|
|
200
|
+
...cleanDeep({
|
|
201
|
+
unique: index?.unique || false,
|
|
202
|
+
sparse: index?.sparse || false,
|
|
203
|
+
expireAfterSeconds: index.expireAfterSeconds ?? null,
|
|
204
|
+
}),
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
.catch((err) => {
|
|
208
|
+
console.error(err?.message);
|
|
209
|
+
});
|
|
192
210
|
}
|
|
193
211
|
// Sortie de boule
|
|
194
212
|
}
|