@@ -108,7 +108,7 @@ func MongoList(ctx iris.Context) {
108108}
109109
110110func FindOne (ctx context.Context , username string ) (* User , error ) {
111- var collection = zgo .Mgo .GetCollection ("profile" , "bj" , "mgo_label_bj " )
111+ var collection = zgo .Mongo .GetCollection ("profile" , "bj" , "mongo_label_bj " )
112112
113113 filter := make (map [string ]interface {}) //查询username是且age >= 30的
114114 filter ["username" ] = username
@@ -135,7 +135,7 @@ func FindOne(ctx context.Context, username string) (*User, error) {
135135 Result : r , //传入 &User{} ,结果
136136 }
137137
138- _ , err := zgo .Mgo .FindOne (ctx , collection , args )
138+ _ , err := zgo .Mongo .FindOne (ctx , collection , args )
139139 if err != nil {
140140 return nil , err
141141 }
@@ -144,7 +144,7 @@ func FindOne(ctx context.Context, username string) (*User, error) {
144144}
145145
146146func Find (ctx context.Context , username string ) ([]* User , error ) {
147- var collection = zgo .Mgo .GetCollection ("profile" , "bj" , "mgo_label_bj " )
147+ var collection = zgo .Mongo .GetCollection ("profile" , "bj" , "mongo_label_bj " )
148148
149149 filter := make (map [string ]interface {}) //查询username是且age >= 30的
150150 filter ["username" ] = username
@@ -170,7 +170,7 @@ func Find(ctx context.Context, username string) ([]*User, error) {
170170 Skip : 0 , //从哪一条开始跳过 开区间,不包括skip的值
171171 }
172172
173- results , err := zgo .Mgo .Find (ctx , collection , args )
173+ results , err := zgo .Mongo .Find (ctx , collection , args )
174174 if err != nil {
175175 return nil , err
176176 }
0 commit comments