nedb icon indicating copy to clipboard operation
nedb copied to clipboard

Added positional operator ($) support when updating documents.

Open HowlingGuineapig opened this issue 8 years ago • 4 comments

Heavily inspired by the work of @mitsos1os, I needed this feature for a project but it was lost amongst a large set of commits and never pulled. Hopefully this fits the guidelines, let me know what you think.

HowlingGuineapig avatar Jul 22 '16 19:07 HowlingGuineapig

@HowlingGuineapig I was planning to restructure my commits with the form required by the author but I was completely out of free time. I hope you get to add this feature in this good project!

mitsos1os avatar Jul 23 '16 13:07 mitsos1os

Hi @HowlingGuineapig, will it work to change an object property inside an array of objects? Like in the example below:

db.update({ 'objects.anyIdentifier': 'id' }, { $set: { 'objects.$.anyProperty': 'newValue' } }, {}, function () { })

rozamirandar avatar Nov 16 '16 17:11 rozamirandar

Hi @rodzero, yes that is exactly the sort of thing I made this pull request for, but I made a mistake when writing the README. I tried to make the entry look like all those around it and instead wrote an example that just doesn't work. I have fixed the README now with a working example that looks a bit more like yours. Thanks for pointing it out.

HowlingGuineapig avatar Nov 17 '16 12:11 HowlingGuineapig

Merged into nedb3

pi0 avatar Nov 30 '16 09:11 pi0