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
|
import { model, Schema, ObjectId } from 'mongoose';
/**
* User schema for MongoDB.
* @type {module:mongoose.Schema}
*/
export const spendHistorySchema = new Schema(
{
venue: {
type: String,
required: true,
immutable: true
},
reason: {
type: String,
required: true,
immutable: true
},
amount: {
type: Number,
required: true,
immutable: true
}
},
{
timestamps: {
createdAt: true,
updatedAt: false
},
timeseries: {
timeField: 'createdAt'
}
}
);
export const DbSpendHistory = model('spendHistory', spendHistorySchema);
console.log('[MONGODB] spendHistory schema initialized successfully!');
|