apostrophe cms - Why inserting a doc result to an array -
using apostrophe tasks purposes, wonder why self.docs['my-module'].insert(...) result array element in third position in callback.
expected: plain object directly.
steps reproduce :
// lib/modules/my-module/index.js module.exports = { construct: (self, options) => { self.apos.modules['apostrophe-tags'].insert({}, { title: 'test' }, {permissions: false}, (err, doc) => { console.log(doc); // [undefined, undefined, the_doc, undefined, undefined] } ); } }; console.log show array data "in middle".
my worries behind make safe way : doc[2]. , i'm unable find why in source code ...
while insert method of apostrophe-docs deliver doc callback after err argument, insert method of apostrophe-pieces , of subclasses including apostrophe-tags not document arguments callback other err. not necessary because piece object passed same 1 arrive @ callback, have in scope.
it has been modified, i.e. _id has been added, createdat , updatedat , slug have been set, etc. same object, can @ object passed see these changes.
Comments
Post a Comment