Skip to content

Commit

Permalink
style(schema): improve jsdocs examples
Browse files Browse the repository at this point in the history
  • Loading branch information
lykmapipo committed Apr 27, 2019
1 parent be12d5e commit 1a94b3e
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions lib/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function createSchema(bucket) {
* @description Write provided file into MongoDB GridFS
* @param {stream.Readable} stream readable stream
* @param {Function} [done] a callback to invoke in success or error
* @return {GridFSBucketWriteStream} a GridFSBucketWriteStream instance.
* @return {Model} valid instance of mongoose model.
* @see {@link https://docs.mongodb.com/manual/core/gridfs/}
* @see {@link http://mongodb.github.io/node-mongodb-native}
* @see {@link https://nodejs.org/api/stream.html#stream_writable_streams}
Expand All @@ -63,11 +63,12 @@ function createSchema(bucket) {
* @since 1.0.0
* @version 0.1.0
* @instance
* @instance
* @example
*
* const attachment = new Attachment({ filename });
* attachment.write(readablestream, (error, attached) => { ... });
* attachment.write(readablestream, (error, attached) => {
* //=> {_id: ..., filename: ..., ... }
* });
*
*/
FileSchema.methods.write = function write(stream, done) {
Expand Down Expand Up @@ -152,7 +153,9 @@ function createSchema(bucket) {
* @instance
* @example
*
* attachment.unlink((error, unlinked) => { ... });
* attachment.unlink((error, unlinked) => {
* //=> {_id: ..., filename: ..., ... }
* });
*
*/
FileSchema.methods.unlink = function unlink(done) {
Expand Down Expand Up @@ -198,7 +201,9 @@ function createSchema(bucket) {
* const writeStream = Attachment.write({ filename }, readStream);
*
* // small file
* Attachment.write({ filename }, readstream, (error, file) => { ... });
* Attachment.write({ filename }, readstream, (error, file) => {
* //=> {_id: ..., filename: ..., ... }
* });
*
*/
FileSchema.statics.write = function write(file, stream, done) {
Expand Down Expand Up @@ -271,7 +276,9 @@ function createSchema(bucket) {
* @public
* @example
*
* Attachment.unlink(_id, (error, unlinked) => { ... });
* Attachment.unlink(_id, (error, unlinked) => {
* //=> {_id: ..., filename: ..., ... }
* });
*
*/
FileSchema.statics.unlink = function unlink(_id, done) {
Expand Down

0 comments on commit 1a94b3e

Please sign in to comment.