From a797d6f4798c8794dfe45fb745ecadd659ad77e5 Mon Sep 17 00:00:00 2001 From: jackyzha0 Date: Sat, 9 May 2020 12:55:48 -0700 Subject: outline insert op --- db/mongo.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'db/mongo.go') diff --git a/db/mongo.go b/db/mongo.go index 4c3b88a..c3e31dd 100644 --- a/db/mongo.go +++ b/db/mongo.go @@ -10,7 +10,7 @@ import ( ) var Session *mgo.Session -var TextDB *mgo.Collection +var pastes *mgo.Collection func initSessions(user, pass, ip string) { log.Infof("attempting connection to %s", ip) @@ -35,5 +35,9 @@ func initSessions(user, pass, ip string) { } // Define connection to Databases - TextDB = Session.DB("main").C("pastes") + pastes = Session.DB("main").C("pastes") +} + +func insert(new Paste) error { + return pastes.Insert(new) } -- cgit v1.2.3