I suspect the problem is the ## in the key part of the structure.

You may want to build up the structure using StructInsert() instead

On 18/12/2013 09:00, Rick wrote:
Hey Alan,

Absolutely... Please also see the attachment.

// run function to get required variables for mongodb nested array issue
var dbVars = _CreateObjForNestedArrayMongodbIssue(GetAllBookChsForArrayPos[1].chapters, arguments.target, arguments.chapterId, newSortNum);

// set the new sort number for existing section
var objUpdateSectionSortNum = MongoCollectionUpdate( db, "book",
{ "_id" : MongoObjectid( arguments.bookId ), "chapters.sections.chapterId": arguments.chapterId },{$set: {""chapters.#dbVars.targetArrayChapterPos#.sections.#dbVars.
targetArraySectionPos#.chSort": newSortNum }});

From what is looks like from the docs, I should probably be able to use $ as the last array position since I've already defined the chapterId for the query.










On Wednesday, December 18, 2013 8:46:12 AM UTC-5, Alan Williamson wrote:

    Can we see the actual CFML code you are trying to do ...

    On 18/12/2013 08:12, Rick wrote:
    I am trying to update a nested array value by pointing to the
    precise nested array path by identifying the array index for each
    subdocument.

    This is where I am having trouble.  I have accurately identified
    the indexes for the path I need to update the subdocument but the
    mongodb function does not seem to like cf variables in the
    "field".  It attempts to use the variable name instead of
    evaluating it.

    Here's an example:

    {$set:
    
{"chapters.#dbVars.targetArray*Chapter*Pos#.sections.#dbVars.targetArray*Section*Pos#.chSort":
    newSortNum } }

    According to many, once you begin to have deeper nested arrays,
    you have to define the precise array path with indexes.  See one
    example below...

    
http://stackoverflow.com/questions/18173482/mongodb-update-deeply-nested-subdocument
    
<http://stackoverflow.com/questions/18173482/mongodb-update-deeply-nested-subdocument>

    Thanks
-- -- online documentation: http://openbd.org/manual/
    http://groups.google.com/group/openbd?hl=en
    <http://groups.google.com/group/openbd?hl=en>

    ---
    You received this message because you are subscribed to the
    Google Groups "Open BlueDragon" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to [email protected] <javascript:>.
    For more options, visit https://groups.google.com/groups/opt_out
    <https://groups.google.com/groups/opt_out>.

--
--
online documentation: http://openbd.org/manual/
http://groups.google.com/group/openbd?hl=en

---
You received this message because you are subscribed to the Google Groups "Open BlueDragon" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

--
--
online documentation: http://openbd.org/manual/
http://groups.google.com/group/openbd?hl=en

--- You received this message because you are subscribed to the Google Groups "Open BlueDragon" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to