浏览代码

排序由map无须改为有序

wangchuanjin 4 年之前
父节点
当前提交
4256c6079f
共有 1 个文件被更改,包括 0 次插入14 次删除
  1. 0 14
      src/mongodb/mongodb.go

+ 0 - 14
src/mongodb/mongodb.go

@@ -16,7 +16,6 @@ import (
 	"go.mongodb.org/mongo-driver/bson/primitive"
 	"go.mongodb.org/mongo-driver/bson/primitive"
 	"go.mongodb.org/mongo-driver/mongo"
 	"go.mongodb.org/mongo-driver/mongo"
 	"go.mongodb.org/mongo-driver/mongo/options"
 	"go.mongodb.org/mongo-driver/mongo/options"
-	"go.mongodb.org/mongo-driver/mongo/readpref"
 )
 )
 
 
 func NewMgo(addr, db string, size int) *MongodbSim {
 func NewMgo(addr, db string, size int) *MongodbSim {
@@ -773,16 +772,3 @@ func autoUpdateTime(db, coll string, ue *bson.M) {
 		(*ue)["$set"] = set
 		(*ue)["$set"] = set
 	}
 	}
 }
 }
-
-func (ms *MgoSess) ExampleDatabase_RunCommand() {
-	// run an explain command to see the query plan for when a "find" is executed on collection "bar"
-	// specify the ReadPreference option to explicitly set the read preference to primary
-	findCmd := bson.D{{"find", ms.coll}, {"projectid", "5f6bc002499cb0822d7e3322"}}
-	command := bson.D{{"explain", findCmd}}
-	opts := options.RunCmd().SetReadPreference(readpref.Primary())
-	var result bson.M
-	if err := ms.M.C.Database(ms.db).RunCommand(context.TODO(), command, opts).Decode(&result); err != nil {
-		log.Fatal(err)
-	}
-	fmt.Println(result)
-}