@riocrypto/common-server 1.0.2918 → 1.0.2919
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/build/models/order.js +4 -0
- package/package.json +1 -1
package/build/models/order.js
CHANGED
|
@@ -415,6 +415,10 @@ const buildOrder = (mongoose) => {
|
|
|
415
415
|
// At most one order per real quoteId. Imported orders use quoteId "" and are
|
|
416
416
|
// excluded by the partial filter (which also serves the createOrder lookup).
|
|
417
417
|
orderSchema.index({ quoteId: 1 }, { unique: true, partialFilterExpression: { quoteId: { $gt: "" } } });
|
|
418
|
+
// Looking up an order by quote matches on quoteId or expiredQuotes in one
|
|
419
|
+
// $or, and an $or falls back to a collection scan unless every branch is
|
|
420
|
+
// indexed. Without this the partial quoteId index above never gets used.
|
|
421
|
+
orderSchema.index({ expiredQuotes: 1 });
|
|
418
422
|
// At most one order per (broker family, clientReferenceId). rootUserId is
|
|
419
423
|
// brokerId || userId; orders without a clientReferenceId (or, defensively,
|
|
420
424
|
// without rootUserId) are excluded from the constraint.
|