[SERVER-1055] error message "can't append to array using string field name" on indexed list updates Created: 26/Apr/10  Updated: 12/Jul/16  Resolved: 10/May/10

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: 1.4.0, 1.4.1
Fix Version/s: 1.5.2

Type: Bug Priority: Major - P3
Reporter: Steffen Schneider Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 7, 64bit (1.4.1), (and Linux MongoDB v1.4.0 as reported by other user)


Participants:

 Description   

as discussed on http://groups.google.com/group/mongodb-user/browse_thread/thread/c5b67a50b814ce46#

When I try to update a value in an indexed list I get the error:
"can't append to array using string field name"

As soon as I remove the index, the update performs with no problems.

I have some test documents like this:

{"cast":["Samuel","John"],"movie":"Pulp Fiction"} {"cast":["John","Hugh","Halle"],"movie":"Swordfish"}

"cast" has an ascending index.

My update routine in PHP looks like this:
$collection->update(
array('cast' => 'John'),
array('$set' => array('cast.$' => 'John Travolta')),
array('multiple' => TRUE)
);

I've tried the same on the console, same result: with index I get the error,
without the index the update works.



 Comments   
Comment by auto [ 10/May/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: $ operator and indexed fields SERVER-1055
http://github.com/mongodb/mongo/commit/4ea65d35986af7bdafdca7cc9ec6a67b24e63bf5

Comment by auto [ 27/Apr/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: test for SERVER-1055
http://github.com/mongodb/mongo/commit/3cbdcddd136c3c92986c4393210364273529a129

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