KingCanadian
unread,Jun 1, 2012, 2:13:35 PM6/1/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongodb-user
Hello,
i want to index the value of a nested array (dateien.md5) - how can i
do this?
I have a Document like:
========================================
{
"dateien": [
{
"dateiname": "domino_20120529155008_0690012.jpg",
"md5": "6351f0c9ab076f16d12e6f77ec13e10d",
"bindata": "<Mongo Binary Data>"
}
],
"dokumentenart": "Einzugsermächtigung",
"dokumentenverz": "EZE_VS",
"erfassung_1_benid": "69",
"erfassung_1_tsp": "20120530082850",
"erfassung_1_zahlernummer": "31466308",
"erfassung_2_benid": "15",
"erfassung_2_tsp": "20120530112553",
"erfassung_2_zahlernummer": "31466308",
"import_benid": 10,
"scan_tsp": "20120529155049",
"seiten": 1,
"seitigkeit": 1,
"status": 5
}
========================================
Sometimes i have to search for the Value in dateien.md5
So i want to make a index for it with
.ensureIndex({dateien:1})
How can i see if the index was used when
findOne('dateien.md5'=>"6351f0c9ab076f16d12e6f77ec13e10d")
??
I tryed the explan command but there is no difference:
With Index ensured
========================================
Antwort vom Server:
{
"cursor": "BtreeCursor _id_ reverse",
"nscanned": 22477,
"nscannedObjects": 22477,
"n": 1,
"millis": 130,
"nYields": 0,
"nChunkSkips": 0,
"isMultiKey": false,
"indexOnly": false,
"indexBounds": {
"_id": [
[
{
"$maxElement": 1
},
{
"$minElement": 1
}
]
]
},
"allPlans": [
{
"cursor": "BtreeCursor _id_ reverse",
"indexBounds": {
"_id": [
[
{
"$maxElement": 1
},
{
"$minElement": 1
}
]
]
}
},
{
"cursor": "BasicCursor",
"indexBounds": [
]
}
],
"oldPlan": {
"cursor": "BtreeCursor _id_ reverse",
"indexBounds": {
"_id": [
[
{
"$maxElement": 1
},
{
"$minElement": 1
}
]
]
}
}
}
========================================
With Index dropped
========================================
Antwort vom Server:
{
"cursor": "BtreeCursor _id_ reverse",
"nscanned": 22477,
"nscannedObjects": 22477,
"n": 1,
"millis": 132,
"nYields": 0,
"nChunkSkips": 0,
"isMultiKey": false,
"indexOnly": false,
"indexBounds": {
"_id": [
[
{
"$maxElement": 1
},
{
"$minElement": 1
}
]
]
},
"allPlans": [
{
"cursor": "BtreeCursor _id_ reverse",
"indexBounds": {
"_id": [
[
{
"$maxElement": 1
},
{
"$minElement": 1
}
]
]
}
},
{
"cursor": "BasicCursor",
"indexBounds": [
]
}
],
"oldPlan": {
"cursor": "BtreeCursor _id_ reverse",
"indexBounds": {
"_id": [
[
{
"$maxElement": 1
},
{
"$minElement": 1
}
]
]
}
}
}
========================================