I'm treating a task hierarchy as a tree. I want to add a subtask to a
top-level task. But I don't want to append at the end of the existing
list, I want to put it at a specific position in the list.

Here's my existing record:

> db.master_projects.find()
 { "_id" : ObjectId("4ca1397c063911217433201c"), "children" : [
        {
                "title" : "Decide on process and resources"
        },
        {
                "title" : "Make guardianship/trustee decisions"
        },
        {
                "title" : "Make LivingWill decision"
        }
], "priority" : 2, "reasoning" : "Why? Because I said so.", "title" :
"Make a Will for each Adult" }

Then I try to insert:
> var mp1 = 
> db.master_projects.findOne({_id:ObjectId("4ca1397c063911217433201c")});
> mp1.children.insert(2, {title: 'Make asset dispersal decisions'})
Wed Sep 29 10:00:45 TypeError: mp1.children.insert is not a function
(shell):0

I'm sure this is easy, but I can't find an example online yet. (Book
is on order.)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to