Sorry to bother you Michael, but don't you think it's a priority task
to be able to update a fied in a nested arrays of a document ?
On Jul 13, 8:58 pm, Antoine <
antoine.fauc...@gmail.com> wrote:
> Ok the things is I don't know before the query where is the value 4.
>
> So it's impossible to write : "x.2.y.3"
>
> I don't know what is the index of the array matching the value 4..
>
> The problem is still here ... !
>
> Anyway, Thank you for help ;-)
>
> Antoine
>
> On Jul 13, 8:52 pm, Michael Dirolf <
m...@10gen.com> wrote:
>
> > From the shell:
>
> > > db.test.save({x: [1, 2, {y: [1, 2, 3, 4]}]});
> > > db.test.update({}, {"$set": {"x.2.y.3": 45}});
> > > db.test.find()
>
> > { "_id" : ObjectId("4c3cb5e40763d13a06a2fa58"), "x" : [ 1, 2, { "y" :
> > [ 1, 2, 3, 45 ] } ] }
>
> > On Tue, Jul 13, 2010 at 2:49 PM, Antoine <
antoine.fauc...@gmail.com> wrote:
> > > array indexes in your updates ?
> > > How should I write the query if i have :
>
> > > db.test.save({x: [1,2,{y: [1, 2, 3, 4]}]});
>
> > > I woud like to replace 4 to 45 so how should I write ?
> > > .... ?
>
> > > Thank you so much ;-)
> > > Antoine
>
> > > On Jul 13, 8:29 pm, Michael Dirolf <
m...@10gen.com> wrote:
> > >> You can updatenestedarrays in the current version by using array
> > >> indexes in your updates, but if you want to update based on a query
> > >> using the positional operator you can only update a value w/in a
> > >> single array, notnestedin multiple arrays.
>
> > >> That limitation is there mainly because the positional operator is
> > >> pretty new. See the case I mentioned above which will add support for
> > >> this.
>
> > >> On Tue, Jul 13, 2010 at 1:56 PM, Antoine <
antoine.fauc...@gmail.com> wrote:
> > >> > I don't fell it is really complex operation to update anestedarray
> > >> > field ?
>
> > >> > I don't understand why we shoud usenesteddocument if we can't update
> > >> > them ;-)
>
> > >> > Thank you again ;-)
>
> > >> > Antoine
>
> > >> > On Jul 13, 7:44 pm, Michael Dirolf <
m...@10gen.com> wrote:
> > >> >> Often it's possible to rethink your schema to get around the need for
> > >> >> these sorts of complex updates. Might be worth reading some of the
> > >> >> example schemas posted on various blogs, the mongodb cookbook, etc. to
> > >> >> get some ideas.
>
> > >> >> On Tue, Jul 13, 2010 at 1:39 PM, Antoine <
antoine.fauc...@gmail.com> wrote:
> > >> >> > Ok I was thinking I can use mongodb but I need to update some array in
> > >> >> > somenesteddocument..... !
>
> > >> >> > I hope I will be able to do that soon ;-)
>
> > >> >> > Thank you for your answer ;-)
>
> > >> >> > Antoine
>
> > >> >> > On Jul 13, 7:22 pm, Michael Dirolf <
m...@10gen.com> wrote:
> > >> >> >> Sorry I thought you meant an array w/innesteddocuments, not other
> > >> >> >>nestedarrays. For your scenario you'd need this case to be
> ...
>
> read more »