Using jsonpatch to create new path

diego

I'm trying to use jsonpatch to create new path in a mongoose document, but I can't make it work.

The page oficial page enter link description here says that I can add new values to a path like this,

{op: add, path:/mypath, value: 'new value'}

But what I want is to add new path with new values. I've try passing a variable to the path like this:

var valuesItem = [{
            op: 'add',
            path: '/' + data,
            value: 'data'
        }];

But that don't work. Thanks.

diego

I have to change the way that it was updated the data in the database, like this:

value = value.toObject();
var patches = request.payload;
jsonpatch.apply(value, patches);

      Value.update({ _id: request.params.id }, value, { overwrite: true }, function(err) {
        if (err) {
          reply(err);
        } else {
         ...code...
        }

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to create a new folder under given path using Java?

From Dev

Create new absolute path from absolute path + relative or absolute path

From Dev

Create new absolute path from absolute path + relative or absolute path

From Dev

How to create a new parent node outside the .ref(/path) in Firebase Realtime Database using Cloud Functions (Typescript)?

From Dev

iterate path + filenames to create new file objects

From Dev

Create shortcut using app path

From Dev

Create a new column using a map

From Dev

Using a button to create a new component

From Dev

Create a new div using jQuery

From Dev

New and Create actions using Cells

From Dev

Using loop to create new variables

From Dev

Create object using new vs of

From Dev

Using a button to create a new component

From Dev

Create a new div using jQuery

From Dev

Create a new user using UserPrincipalEX

From Dev

Create new object by using namespace

From Dev

Using loop to create new variables

From Dev

Using the basename of current path to define a new file

From Dev

Create custom symbol on polyline using SVG path

From Dev

Create custom symbol on polyline using SVG path

From Dev

create folder in php using a variable in path

From Dev

Path not found when using InvokeMethod create

From Dev

Create file using wildcard in absolute path

From Dev

ACE - is it possible to create a pipe using fast path?

From Dev

Can't create new controllers - Access to the path is denied

From Dev

Null PointerException when trying to create a File file=new File(path)

From Dev

Struts2: Create a new file inside the context path and write to it

From Dev

Why cannot create new file,is the path or the pathname separator correct?

From Dev

Create new tmux session inside a session with default path and name

Related Related

  1. 1

    How to create a new folder under given path using Java?

  2. 2

    Create new absolute path from absolute path + relative or absolute path

  3. 3

    Create new absolute path from absolute path + relative or absolute path

  4. 4

    How to create a new parent node outside the .ref(/path) in Firebase Realtime Database using Cloud Functions (Typescript)?

  5. 5

    iterate path + filenames to create new file objects

  6. 6

    Create shortcut using app path

  7. 7

    Create a new column using a map

  8. 8

    Using a button to create a new component

  9. 9

    Create a new div using jQuery

  10. 10

    New and Create actions using Cells

  11. 11

    Using loop to create new variables

  12. 12

    Create object using new vs of

  13. 13

    Using a button to create a new component

  14. 14

    Create a new div using jQuery

  15. 15

    Create a new user using UserPrincipalEX

  16. 16

    Create new object by using namespace

  17. 17

    Using loop to create new variables

  18. 18

    Using the basename of current path to define a new file

  19. 19

    Create custom symbol on polyline using SVG path

  20. 20

    Create custom symbol on polyline using SVG path

  21. 21

    create folder in php using a variable in path

  22. 22

    Path not found when using InvokeMethod create

  23. 23

    Create file using wildcard in absolute path

  24. 24

    ACE - is it possible to create a pipe using fast path?

  25. 25

    Can't create new controllers - Access to the path is denied

  26. 26

    Null PointerException when trying to create a File file=new File(path)

  27. 27

    Struts2: Create a new file inside the context path and write to it

  28. 28

    Why cannot create new file,is the path or the pathname separator correct?

  29. 29

    Create new tmux session inside a session with default path and name

HotTag

Archive