From 30edb4d9fae5fac199c46afd063e3595eba4026b Mon Sep 17 00:00:00 2001 From: hoteas Date: Tue, 30 Aug 2022 04:05:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0mongodb=E9=A9=B1=E5=8A=A8?= =?UTF-8?q?=EF=BC=8C=E7=AE=80=E5=8D=95=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dri/mongodb/mongodb.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dri/mongodb/mongodb.go b/dri/mongodb/mongodb.go index 42c5238..437301f 100644 --- a/dri/mongodb/mongodb.go +++ b/dri/mongodb/mongodb.go @@ -86,7 +86,11 @@ func (that *mongoDb) Get(table string, where Map) Map { that.LastErr = err return nil } - return results[0] + if len(results) > 0 { + + return results[0] + } + return nil } func (that mongoDb) Select(table string, where Map, page, pageRow int64) []Map {