[SERVER-213] Array.fetchRefs( colName ) ( WAS : db.col.findOne().val.fetchAll() for lists of DBRefs ) Created: 06/Aug/09 Updated: 12/Jul/16 Resolved: 05/Oct/09 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.1.2 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Phillip Oldham | Assignee: | Eliot Horowitz (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
The shell provides a way to fetch a DBRef'd document into the current one. It would be very useful to be able to do this on a list/array value - each document in an array which looks like a DBRef is fetched into the current doc. An example to illustrate the concept: > var other = { s : "other thing", n : 1}; > var another = { s : "another thing", n : 2}; > var mongo = db.things.findOne(); > db.things.save(mongo); , "otherthings" : [ {"_id" : "497dbcb36b27d59a708e89a4" , "s" : "other thing" , "n" : 1}, {"_id" : "4a7aabf13240ba3080db97dd" , "s" : "another thing" , "n" : 2}] } |
| Comments |
| Comment by Eliot Horowitz (Inactive) [ 16/Oct/09 ] |
|
release 10/16/2009 |
| Comment by Eliot Horowitz (Inactive) [ 17/Aug/09 ] |
|
I'm thinking it would stay as fetch() |
| Comment by Phillip Oldham [ 17/Aug/09 ] |
|
"maybe we should add a _ns field to the objects to se know which collection they came from" Sounds good. Will there be a corresponding .fetchRef() then, for singular DBRef instances? Or will this stay as .fetch()? |
| Comment by Eliot Horowitz (Inactive) [ 17/Aug/09 ] |
|
Going to add a method to Array fetchRefs( collectionName )
maybe we should add a _ns field to the objects to se know which collection they came from... |
| Comment by Phillip Oldham [ 17/Aug/09 ] |
|
Sounds ok. The reason I mentioned replacing the array items is that if it's a mixed array it would make more sense, but as long as it can recognise the DBRefs in the array and collect those documents that should be fine. However, if the DBRefs link to documents in different collections, how would one know which collection a doc came from in the returned results? |
| Comment by Eliot Horowitz (Inactive) [ 16/Aug/09 ] |
|
How would you feel about fetchAll() returning a list rather than replacing the list? |