Added online field to Articles

This commit is contained in:
Florian Sylvain
2022-12-30 03:06:25 +01:00
parent 7107e4e867
commit 3d43042245
3 changed files with 6 additions and 0 deletions
+1
View File
@@ -11,6 +11,7 @@ type Article struct {
Date int64 `json:"date" bson:"date"` Date int64 `json:"date" bson:"date"`
Content gin.H `json:"content" bson:"content"` Content gin.H `json:"content" bson:"content"`
PageID string `json:"page_id" bson:"page_id"` PageID string `json:"page_id" bson:"page_id"`
Online bool `json:"online" bson:"online"`
} }
var articlesLocation = database.Location{Database: "gohcms", Collection: "articles"} var articlesLocation = database.Location{Database: "gohcms", Collection: "articles"}
+2
View File
@@ -13,6 +13,7 @@ var Article1, _ = bson.Marshal(Article{
Date: 1671482492, Date: 1671482492,
Content: gin.H{}, Content: gin.H{},
PageID: "blog", PageID: "blog",
Online: false,
}) })
var Article2, _ = bson.Marshal(Article{ var Article2, _ = bson.Marshal(Article{
@@ -20,6 +21,7 @@ var Article2, _ = bson.Marshal(Article{
Date: 1671899112, Date: 1671899112,
Content: gin.H{}, Content: gin.H{},
PageID: "blog", PageID: "blog",
Online: false,
}) })
var BSONConvertedArticles = [][]byte{Article1, Article2} var BSONConvertedArticles = [][]byte{Article1, Article2}
+3
View File
@@ -21,6 +21,9 @@ db.createCollection('articles', {
}, },
page_id: { page_id: {
bsonType: 'string' bsonType: 'string'
},
online: {
bsonType: 'bool'
} }
} }
} }