[SERVER-990] allow returning just the final key when using dot notation Created: 09/Apr/10  Updated: 17/May/10  Resolved: 17/May/10

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: pablo platt Assignee: Eliot Horowitz (Inactive)
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

When querying with dot notation mongodb returns the full path of the object.
Most of the times the desired behavior is to get only the final key.
This feature can be configured with 'shortPath: true' or 'lastKey: true'.

Let's consider the following doc:
db.session.save({"userid":"5", "key1": {"key2": "val2"}});

and a dot notation query:
db.session.find(

{"userid":"5"}

,

{"key1.key2":1}

);

result:
[{
"_id" : ObjectId("4bb72974f9054d050a00489f"),
"key1" :

{ "key2" : "val2" }

}]

I suggest that the result will be:
[{
"_id" : ObjectId("4bb72974f9054d050a00489f"),
"key2" : "val2"
}]

Thanks



 Comments   
Comment by Eliot Horowitz (Inactive) [ 17/May/10 ]

I don't think that is what most people want in general.
virtual collections ( SERVER-142 ) is probably the right solution

Generated at Thu Feb 08 02:55:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.