File tree Expand file tree Collapse file tree 2 files changed +38
-7
lines changed Expand file tree Collapse file tree 2 files changed +38
-7
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,14 @@ const updateDoc = async () => {
36
36
} )
37
37
) . result ;
38
38
39
+ // Note: for byte response (Output Stream) use:
40
+ // const documentAsStream = (
41
+ // await client.getDocumentAsStream({
42
+ // docId: 'example',
43
+ // db: exampleDbName,
44
+ // })
45
+ // ).result;
46
+
39
47
// Add Bob Smith's address to the document
40
48
document . address = '19 Front Street, Darlington, DL5 1TY' ;
41
49
@@ -50,6 +58,14 @@ const updateDoc = async () => {
50
58
} )
51
59
) . result . rev ;
52
60
61
+ // Note: for byte request (Input Stream) use:
62
+ // document._rev = (
63
+ // await client.postDocument({
64
+ // db: exampleDbName,
65
+ // document: inputStream,
66
+ // })
67
+ // ).result.rev;
68
+
53
69
console . log (
54
70
'You have updated the document:\n' + JSON . stringify ( document , null , 2 )
55
71
) ;
Original file line number Diff line number Diff line change @@ -35,6 +35,15 @@ const getDocParams: CloudantV1.GetDocumentParams = {
35
35
db : exampleDbName ,
36
36
} ;
37
37
38
+ // Note: for byte response (Output Stream) use:
39
+ // const getdocAsStreamParam: CloudantV1.GetDocumentAsStreamParams = {
40
+ // docId: 'example',
41
+ // db: exampleDbName,
42
+ // };
43
+ // client
44
+ // .getDocumentAsStream(getdocAsStreamParam)
45
+ // .then((outputStream) => {});
46
+
38
47
client
39
48
. getDocument ( getDocParams )
40
49
. then ( ( docResult ) => {
@@ -48,13 +57,19 @@ client
48
57
delete document . joined ;
49
58
50
59
// Update the document in the database
51
- client . postDocument ( { db : exampleDbName , document } ) . then ( ( res ) => {
52
- // Keeping track with the revision number of the document object:
53
- document . _rev = res . result . rev ;
54
- console . log (
55
- 'You have updated the document:\n' + JSON . stringify ( document , null , 2 )
56
- ) ;
57
- } ) ;
60
+ client
61
+ . postDocument ( { db : exampleDbName , document } )
62
+ // Note: for byte request (Input Stream) use:
63
+ // .postDocument(
64
+ // {db: exampleDbName, documentAsStream}
65
+ // )
66
+ . then ( ( res ) => {
67
+ // Keeping track with the revision number of the document object:
68
+ document . _rev = res . result . rev ;
69
+ console . log (
70
+ 'You have updated the document:\n' + JSON . stringify ( document , null , 2 )
71
+ ) ;
72
+ } ) ;
58
73
} )
59
74
. catch ( ( err ) => {
60
75
if ( err . code === 404 ) {
You can’t perform that action at this time.
0 commit comments