mirror of
https://github.com/wassname/talk.git
synced 2026-07-29 11:28:24 +08:00
Added index for item_id on Actions.
This commit is contained in:
+10
-2
@@ -21,8 +21,8 @@ const ActionSchema = new Schema({
|
||||
item_id: String,
|
||||
user_id: String,
|
||||
|
||||
// The element that summaries will additionally group on in addtion to their action_type, item_type, and
|
||||
// item_id.
|
||||
// The element that summaries will additionally group on in addition to their
|
||||
// action_type, item_type, and item_id.
|
||||
group_id: String,
|
||||
|
||||
// Additional metadata stored on the field.
|
||||
@@ -34,6 +34,14 @@ const ActionSchema = new Schema({
|
||||
}
|
||||
});
|
||||
|
||||
// Create an index on the `item_id` field so that queries looking for
|
||||
// actions based on the item id can resolve faster.
|
||||
ActionSchema.index({
|
||||
'item_id': 1
|
||||
}, {
|
||||
background: true
|
||||
});
|
||||
|
||||
const Action = mongoose.model('Action', ActionSchema);
|
||||
|
||||
module.exports = Action;
|
||||
|
||||
Reference in New Issue
Block a user