"filter" : {
"name" : {
"$eq" : "tb0"
}
},
"direction" : "forward"
},
"rejectedPlans" : [ ]
},
"serverInfo" : {
"host" : "tb",
"port" : 12345,
"version" : "3.0.6",
"gitVersion" : "1ef45a23a4c5e3480ac919b28afcba3c615488f2"
},
"ok" : 1
"name" : {
"$eq" : "tb0"
}
},
"direction" : "forward"
},
"rejectedPlans" : [ ]
},
"serverInfo" : {
"host" : "tb",
"port" : 12345,
"version" : "3.0.6",
"gitVersion" : "1ef45a23a4c5e3480ac919b28afcba3c615488f2"
},
"ok" : 1
2015-10-13
> db.person.find({name:"tb0"}).explain()
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "person.person",
"indexFilterSet" : false,
"parsedQuery" : {
"name" : {
"$eq" : "tb0"
}
},
"winningPlan" : {
"stage" : "COLLSCAN",
"
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "person.person",
"indexFilterSet" : false,
"parsedQuery" : {
"name" : {
"$eq" : "tb0"
}
},
"winningPlan" : {
"stage" : "COLLSCAN",
"
2015-10-13
The available shape operators are:
$box,
$polygon,
$center (defines a circle), and
$centerSphere (defines a circle on a sphere).
$box,
$polygon,
$center (defines a circle), and
$centerSphere (defines a circle on a sphere).
2015-10-13
现在官方文档用create创建唯一索引了
db.collection.createIndex( { a: 1 }, { unique: true } )
但是会报错。
报什么错在下节告诉你
db.collection.createIndex( { a: 1 }, { unique: true } )
但是会报错。
报什么错在下节告诉你
2015-10-12
db.tdemo.ensureIndex({m:1,n:1,b:1},{unique:true})
{
"createdCollectionAutomatically" : false,
"numIndexesBefore" : 5,
"errmsg" : "exception: E11000 duplicate key error index: tdemo.tdemo.$m_1_n_1_b_1 dup key: { : null, : null, : null }",
"code" : 11000,
"ok" : 0
}
{
"createdCollectionAutomatically" : false,
"numIndexesBefore" : 5,
"errmsg" : "exception: E11000 duplicate key error index: tdemo.tdemo.$m_1_n_1_b_1 dup key: { : null, : null, : null }",
"code" : 11000,
"ok" : 0
}
2015-10-12
db.tdemo.find({$text:{$search:"aa bb cc"}},{score:{$meta:"textScore"}}).sort({score:{$meta:"textScore"}})
{ "_id" : ObjectId("561b2efa1d7564ee57e78246"), "article" : "aa bb cc df", "score" : 1.875 }
{ "_id" : ObjectId("561b2f021d7564ee57e78247"), "article" : "aa rr cc df", "score" : 1.25 }
{ "_id" : ObjectId("561b2efa1d7564ee57e78246"), "article" : "aa bb cc df", "score" : 1.875 }
{ "_id" : ObjectId("561b2f021d7564ee57e78247"), "article" : "aa rr cc df", "score" : 1.25 }
2015-10-12