Skip to content

Instantly share code, notes, and snippets.

@nono
Last active September 29, 2015 13:54
Show Gist options
  • Save nono/5a5bbfa97efea7d65aaf to your computer and use it in GitHub Desktop.
Save nono/5a5bbfa97efea7d65aaf to your computer and use it in GitHub Desktop.
Couchdb changes for files/folders operations

Folders

Create

{ id: "5ddd48869033f0595a9619d46805e0da",
  changes: [ { rev: "1-21b1243be5cc354143d8613575225a74" } ],
  doc:
   { path: "/parent",
     name: "foo",
     docType: "folder",
     creationDate: "2015-09-29T13:47:45.103Z",
     lastModification: "2015-09-29T13:47:45.103Z",
     tags: [],
     _id: "5ddd48869033f0595a9619d46805e0da",
     _rev: "1-21b1243be5cc354143d8613575225a74" },
  seq: 160 }

and one minute later:

{ id: "5ddd48869033f0595a9619d46805c53c",
  changes: [ { rev: "6-3e93c746ecca4cfdd82ed1c767e1dcf8" } ],
  doc:
   { path: "",
     name: "parent",
     docType: "folder",
     creationDate: "2015-09-29T13:07:28.466Z",
     lastModification: "2015-09-29T13:47:45.103Z",
     tags: [],
     id: "5ddd48869033f0595a9619d46805c53c",
     _id: "5ddd48869033f0595a9619d46805c53c",
     _rev: "6-3e93c746ecca4cfdd82ed1c767e1dcf8" },
  seq: 161 }

Rename

{ id: "5ddd48869033f0595a9619d468058009",
  changes: [ { rev: "2-b87a7b1a53fcbc94abb5487f813d272a" } ],
  doc:
   { path: "/parent",
     name: "foobar",
     docType: "folder",
     creationDate: "2015-09-29T12:58:24.448Z",
     lastModification: "2015-09-29T13:01:05.899Z",
     tags: [],
     _id: "5ddd48869033f0595a9619d468058009",
     _rev: "2-b87a7b1a53fcbc94abb5487f813d272a" },
  seq: 94 }

{ id: "5ddd48869033f0595a9619d468054dc6",
  changes: [ { rev: "11-0968fcf54bd4bfb23cf9758e9c817250" } ],
  doc:
   { path: "",
     name: "parent",
     docType: "folder",
     creationDate: "2015-09-29T10:21:42.546Z",
     lastModification: "2015-09-29T13:01:05.962Z",
     tags: [],
     id: "5ddd48869033f0595a9619d468054dc6",
     _id: "5ddd48869033f0595a9619d468054dc6",
     _rev: "11-0968fcf54bd4bfb23cf9758e9c817250" },
  seq: 95 }

Tag

{ id: "5ddd48869033f0595a9619d468058009",
  changes: [ { rev: "3-86ee4f4c0fea452847d0b7ff38ba1c0b" } ],
  doc:
   { path: "/parent",
     name: "foobar",
     docType: "folder",
     creationDate: "2015-09-29T12:58:24.448Z",
     lastModification: "2015-09-29T13:03:22.465Z",
     tags: [ "baz" ],
     _id: "5ddd48869033f0595a9619d468058009",
     _rev: "3-86ee4f4c0fea452847d0b7ff38ba1c0b" },
  seq: 100 }

{ id: "5ddd48869033f0595a9619d468054dc6",
  changes: [ { rev: "13-057831c0ba72b73ab2540505cdeafb2a" } ],
  doc:
   { path: "",
     name: "parent",
     docType: "folder",
     creationDate: "2015-09-29T10:21:42.546Z",
     lastModification: "2015-09-29T13:03:22.538Z",
     tags: [],
     id: "5ddd48869033f0595a9619d468054dc6",
     _id: "5ddd48869033f0595a9619d468054dc6",
     _rev: "13-057831c0ba72b73ab2540505cdeafb2a" },
  seq: 101 }

Delete

{ id: "5ddd48869033f0595a9619d468058009",
  changes: [ { rev: "4-950cd12107000bc32f80790247830f16" } ],
  doc:
   { docType: "folder",
     _id: "5ddd48869033f0595a9619d468058009",
     _rev: "4-950cd12107000bc32f80790247830f16",
     _deleted: true },
  deleted: true,
  seq: 106 }

{ id: "5ddd48869033f0595a9619d468054dc6",
  changes: [ { rev: "14-7cdc4ea902db7fa405c6aff89e778de4" } ],
  doc:
   { path: "",
     name: "parent",
     docType: "folder",
     creationDate: "2015-09-29T10:21:42.546Z",
     lastModification: "2015-09-29T13:04:13.234Z",
     tags: [],
     id: "5ddd48869033f0595a9619d468054dc6",
     _id: "5ddd48869033f0595a9619d468054dc6",
     _rev: "14-7cdc4ea902db7fa405c6aff89e778de4" },
  seq: 107 }

Files

Create

{ id: "5ddd48869033f0595a9619d468054dc6",
  changes: [ { rev: "15-8e59018963611630cab788dcf816f462" } ],
  doc:
   { path: "",
     name: "parent",
     docType: "folder",
     creationDate: "2015-09-29T10:21:42.546Z",
     lastModification: "2015-09-29T13:06:37.685Z",
     tags: [],
     id: "5ddd48869033f0595a9619d468054dc6",
     _id: "5ddd48869033f0595a9619d468054dc6",
     _rev: "15-8e59018963611630cab788dcf816f462" },
  seq: 127 }

{ id: "5ddd48869033f0595a9619d46805c842",
  changes: [ { rev: "3-10b256e3c45181f7d9ee6134a956870a" } ],
  doc:
   { path: "/parent",
     name: "bar",
     docType: "file",
     mime: "application/octet-stream",
     creationDate: "2015-09-29T13:07:53.045Z",
     lastModification: "2015-09-29T07:37:45.000Z",
     class: "document",
     size: 263,
     tags: [],
     uploading: false,
     binary: { file: [Object] },
     checksum: "251676dbcc73646e3288db61c638baf5bf6dbc75",
     _id: "5ddd48869033f0595a9619d46805c842",
     _rev: "3-10b256e3c45181f7d9ee6134a956870a" },
  seq: 128 }

Rename

{ id: "5ddd48869033f0595a9619d46805c842",
  changes: [ { rev: "4-f970cd5aa4d66267286248133e87e7a9" } ],
  doc:
   { path: "/parent",
     name: "baz",
     docType: "file",
     mime: "application/octet-stream",
     creationDate: "2015-09-29T13:07:53.045Z",
     lastModification: "2015-09-29T07:37:45.000Z",
     class: "document",
     size: 263,
     tags: [],
     uploading: false,
     binary: { file: [Object] },
     checksum: "251676dbcc73646e3288db61c638baf5bf6dbc75",
     _id: "5ddd48869033f0595a9619d46805c842",
     _rev: "4-f970cd5aa4d66267286248133e87e7a9" },
  seq: 135 }

{ id: "5ddd48869033f0595a9619d46805c53c",
  changes: [ { rev: "3-e5eb00260b91d8fb18c9ac1b47454a87" } ],
  doc:
   { path: "",
     name: "parent",
     docType: "folder",
     creationDate: "2015-09-29T13:07:28.466Z",
     lastModification: "2015-09-29T13:09:40.451Z",
     tags: [],
     id: "5ddd48869033f0595a9619d46805c53c",
     _id: "5ddd48869033f0595a9619d46805c53c",
     _rev: "3-e5eb00260b91d8fb18c9ac1b47454a87" },
  seq: 136 }

Tags

{ id: "5ddd48869033f0595a9619d46805c842",
  changes: [ { rev: "5-0b1232c5dc0bff821f8800f9a490be0e" } ],
  doc:
   { path: "/parent",
     name: "baz",
     docType: "file",
     mime: "application/octet-stream",
     creationDate: "2015-09-29T13:07:53.045Z",
     lastModification: "2015-09-29T07:37:45.000Z",
     class: "document",
     size: 263,
     tags: [ "qux" ],
     uploading: false,
     binary: { file: [Object] },
     checksum: "251676dbcc73646e3288db61c638baf5bf6dbc75",
     _id: "5ddd48869033f0595a9619d46805c842",
     _rev: "5-0b1232c5dc0bff821f8800f9a490be0e" },
  seq: 142 }

Delete

{ id: "5ddd48869033f0595a9619d46805c842",
  changes: [ { rev: "6-bcfddf95e2ad6bcdeeb245103c225723" } ],
  doc:
   { docType: "file",
     binary: { file: [Object] },
     _id: "5ddd48869033f0595a9619d46805c842",
     _rev: "6-bcfddf95e2ad6bcdeeb245103c225723",
     _deleted: true },
  deleted: true,
  seq: 148 }

{ id: "5ddd48869033f0595a9619d46805c53c",
  changes: [ { rev: "4-cbbf51615745e694f49d62296b070f0f" } ],
  doc:
   { path: "",
     name: "parent",
     docType: "folder",
     creationDate: "2015-09-29T13:07:28.466Z",
     lastModification: "2015-09-29T13:28:48.812Z",
     tags: [],
     id: "5ddd48869033f0595a9619d46805c53c",
     _id: "5ddd48869033f0595a9619d46805c53c",
     _rev: "4-cbbf51615745e694f49d62296b070f0f" },
  seq: 149 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment