forked from nodemailer/wildduck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
indexes.yaml
741 lines (639 loc) · 16.7 KB
/
indexes.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
---
collections:
# create following collections with specific options
- collection: messages
options:
storageEngine:
wiredTiger:
configString: block_compressor=zlib
- collection: attachments.files
type: gridfs
options:
storageEngine:
wiredTiger:
configString: block_compressor=zlib
- collection: attachments.chunks
type: gridfs
options:
storageEngine:
wiredTiger:
configString: block_compressor=zlib
indexes:
# Indexes for the user collection
- collection: users
type: users # index applies to users database
index:
name: users
key:
username: 1
- collection: users
type: users # index applies to users database
index:
name: users_dotless
unique: true
key:
unameview: 1
- collection: users
type: users # index applies to users database
index:
name: show_new
key:
created: -1
- collection: users
type: users # index applies to users database
index:
name: users_tags
key:
tagsview: 1
sparse: true
# Indexes for the addresses collection
- collection: addresses
type: users # index applies to users database
index:
name: address_dotless
unique: true
key:
addrview: 1
- collection: addresses
type: users # index applies to users database
index:
name: address_tags
key:
tagsview: 1
sparse: true
- collection: addresses
type: users # index applies to users database
index:
name: address_paging
key:
addrview: 1
_id: 1
- collection: addresses
type: users # index applies to users database
index:
name: user
key:
user: 1
# Indexes for the domainaliases collection
- collection: domainaliases
type: users # index applies to users database
index:
name: domainalias
unique: true
key:
alias: 1
- collection: domainaliases
type: users # index applies to users database
index:
name: domainlist
key:
domain: 1
# Indexes for the application specific passwords collection
- collection: asps
type: users # index applies to users database
index:
name: asps_user
key:
user: 1
- collection: asps
type: users # index applies to users database
index:
name: entry_autoexpire
# autoremove log entries after expire seconds
expireAfterSeconds: 0
key:
expires: 1
# Indexes for the authentication log collection
- collection: authlog
type: users # index applies to users database
index:
name: user
key:
user: 1
_id: -1 # sort newer first
- collection: authlog
type: users # index applies to users database
index:
name: insert
key:
user: 1
created: 1
key: 1
- collection: authlog
type: users # index applies to users database
index:
name: user_by_ip
key:
user: 1
ip: 1 # List events for user by IP
_id: -1
partialFilterExpression:
ip: true
- collection: authlog
type: users # index applies to users database
index:
name: by_ip
key:
ip: 1 # All events from this IP
sparse: true
- collection: authlog
type: users # index applies to users database
index:
name: user_hashed
key:
user: hashed # sharding
- collection: authlog
type: users # index applies to users database
index:
name: entry_autoexpire
# autoremove log entries after expire days
expireAfterSeconds: 0
key:
expires: 1
# Indexes for the filters collection
- collection: filters
index:
name: user
key:
user: 1
- collection: filters
index:
name: forward_target
key:
action.targets.value: 1
# Indexes for the allow/block list collection
- collection: domainaccess
index:
name: by_tag
key:
tagview: 1
action: 1
domain: 1
# Indexes for the autoreply collection
- collection: autoreplies
index:
name: autoreply
key:
user: 1
start: 1
end: 1
# Indexes for the mailboxes collection
# note: should mailboxes collection be sharded? could be by user
- collection: mailboxes
index:
name: user_path
unique: true
key:
user: 1
path: 1
- collection: mailboxes
index:
name: user_subscribed
key:
user: 1
subscribed: 1
- collection: mailboxes
index:
name: find_by_type
key:
user: 1
specialUse: 1
# Indexes for the messages collection
- collection: messages
index:
# several message related queries include the shard key values
name: mailbox_uid_shard
key:
_id: 1
mailbox: 1
uid: 1
- collection: messages
index:
name: user_messages_by_thread
key:
user: 1
thread: 1
- collection: messages
index:
# use also as sharding key
name: mailbox_uid
key:
mailbox: 1
uid: 1
_id: 1
- collection: messages
index:
name: mailbox_uid_reverse
key:
mailbox: 1
uid: -1
_id: -1
- collection: messages
index:
name: mailbox_modseq_uid
key:
mailbox: 1
modseq: 1
uid: 1
- collection: messages
index:
name: mailbox_flags
key:
mailbox: 1
flags: 1
- collection: messages
index:
name: by_idate
key:
mailbox: 1
idate: 1
- collection: messages
index:
# index used by api pagination
name: by_idate_reverse_uid
key:
mailbox: 1
idate: -1
_id: -1
- collection: messages
index:
name: by_hdate
key:
mailbox: 1
hdate: 1
msgid: 1
- collection: messages
index:
name: by_size
key:
mailbox: 1
size: 1
- collection: messages
index:
name: by_headers
key:
mailbox: 1
headers.key: 1
headers.value: 1
- collection: messages
index:
# there can be only one $text index per collection
name: fulltext
key:
user: 1
headers.value: text
text: text
partialFilterExpression:
searchable: true # ignore messages marked with \Deleted flag
- collection: messages
index:
# in most cases we only care about unseen, not seen messages
name: mailbox_unseen_flag
key:
mailbox: 1
unseen: 1
- collection: messages
index:
name: user_unseen_flag
key:
user: 1
unseen: 1
partialFilterExpression:
searchable: true
- collection: messages
index:
# some mail agents list messages that do not have the \Deleted flag set
name: mailbox_undeleted_flag
key:
mailbox: 1
undeleted: 1
- collection: messages
index:
name: mailbox_flagged_flag
key:
mailbox: 1
flagged: 1
- collection: messages
index:
name: user_flagged_flag
key:
user: 1
flagged: 1
- collection: messages
index:
name: user_searchable_flag
key:
user: 1
searchable: 1
- collection: messages
index:
name: mailbox_draft_flag
key:
mailbox: 1
draft: 1
- collection: messages
index:
name: has_attachment
key:
mailbox: 1
ha: 1
- collection: messages
index:
# This filter finds all messages that are expired and must be deleted.
# Not sure about performance though as it is a global query
name: retention_time
partialFilterExpression:
exp: true
key:
exp: 1
rdate: 1
# indexes for address register
- collection: addressregister
index:
name: by_address
key:
user: 1
addrview: 1
updated: -1
- collection: addressregister
index:
name: by_name
key:
user: 1
name: 1
updated: -1
# indexes for deleted messages
- collection: archived
index:
name: user_messages
key:
user: 1
_id: 1
# indexes for deleted messages
- collection: archived
index:
name: user_messages_desc
key:
user: 1
_id: -1
- collection: archived
index:
name: user_messages_archived
key:
user: 1
archived: 1
- collection: archived
index:
name: retention_time
partialFilterExpression:
exp: true
key:
exp: 1
rdate: 1
# Indexes for the storage collection
# storage.files collection should be sharded by _id (hash)
# storage.chunks collection should be sharded by files_id (hash)
- collection: storage.files
type: gridfs # index applies to gridfs database
index:
name: storage_id_hashed
key:
_id: hashed
- collection: storage.chunks
type: gridfs # index applies to gridfs database
index:
# hashed index needed for sharding
name: chunks_shard
key:
files_id: hashed
- collection: storage.files
type: gridfs # index applies to gridfs database
index:
name: user_files
key:
metadata.user: 1
filename: 1
# Indexes for the attachments collection
# attachments.files collection should be sharded by _id (hash)
# attachments.chunks collection should be sharded by files_id (hash)
- collection: attachments.files
type: gridfs # index applies to gridfs database
index:
name: attachment_id_hashed
key:
_id: hashed
- collection: attachments.files
type: gridfs # index applies to gridfs database
index:
name: related_attachments_cu
key:
metadata.c: 1
metadata.m: 1
metadata.cu: 1
- collection: attachments.chunks
type: gridfs # index applies to gridfs database
index:
# hashed index needed for sharding
name: chunks_shard
key:
files_id: hashed
- collection: attachments.chunks
type: gridfs # index applies to gridfs database
index:
name: files_id_1_n_1
unique: true
key:
files_id: 1
n: 1
# Indexes for the DKIm collection
- collection: dkim
index:
name: dkim_paging
key:
domain: 1
_id: 1
- collection: dkim
index:
name: dkim_primary
unique: true
key:
domain: 1
# Indexes for the journal collection
- collection: journal
index:
# this index is used to apply changes in a mailbox for IMAP session
name: mailbox_modseq
key:
mailbox: 1
modseq: 1
- collection: journal
index:
# this index is used to send updates to a logged in webmail user
name: user_limit_id
key:
user: 1
_id: 1
- collection: journal
index:
# this index is used to find the latest journal entry
name: user_limit_id_reverse
key:
user: 1
_id: -1
- collection: journal
# delete journal entries after 3 hours
index:
name: journal_autoexpire
expireAfterSeconds: 10800
key:
created: 1
# Indexes for the threads collection
- collection: threads
index:
name: thread_shard
key:
user: hashed
- collection: threads
index:
name: thread
key:
user: 1
ids: 1
- collection: threads
index:
name: thread_autoexpire
# autoremove thread indexes after 180 days of inactivity
expireAfterSeconds: 15552000
key:
updated: 1
- collection: tasks
index:
name: task
key:
locked: 1
lockedUntil: 1
- collection: tasks
index:
name: task_user
key:
task: 1
user: 1
- collection: certs
index:
name: servername
unique: true
key:
servername: 1
- collection: certs
index:
name: servername_version
key:
servername: 1
v: 1
- collection: certs
index:
name: servername_alt
key:
altNames: 1
v: 1
- collection: certs
index:
name: renewal_check
key:
acme: 1
expires: 1
'_acme.lastRenewalCheck': 1
- collection: audits
index:
name: user_expire_time
key:
user: 1
expires: 1
- collection: audits
index:
name: expire_time
key:
expires: 1
deleted: 1
- collection: audit.files
type: gridfs # index applies to gridfs database
index:
name: audit_id_hashed
key:
_id: hashed
- collection: audit.chunks
type: gridfs # index applies to gridfs database
index:
# hashed index needed for sharding
name: audit_shard
key:
files_id: hashed
- collection: audit.files
type: gridfs # index applies to gridfs database
index:
name: audit_files
key:
metadata.audit: 1
metadata.date: 1
- collection: audit.files
type: gridfs # index applies to gridfs database
index:
name: audit_files_queue
key:
metadata.info.queueId: 1
- collection: audit.files
type: gridfs # index applies to gridfs database
index:
name: audit_files_expire
key:
metadata.info.expires: 1
- collection: audit.files
type: gridfs # index applies to gridfs database
index:
name: audit_files_addresses
key:
metadata.audit: 1
metadata.addresses.type: 1
metadata.addresses.name: 1
metadata.addresses.address: 1
- collection: audit.files
type: gridfs # index applies to gridfs database
index:
name: audit_files_subject
key:
metadata.subject: 1
- collection: bimi
index:
name: by_type
unique: true
key:
type: 1
url: 1
- collection: webhooks
index:
name: by_type
key:
type: 1
user: 1
- collection: webhooks
index:
name: by_user_type
key:
user: 1
type: 1
- collection: settings
index:
name: key_unique
unique: true
key:
key: 1
enumerable: 1
- collection: settings
index:
name: enumerable_key
key:
enumerable: 1
key: 1
deleteindexes:
- collection: settings
index: key_enumerable