Apostrophe2 v2.42.0 Release Notes
Release Date: 2017-11-22 // over 6 years ago-
✅ Unit tests passing.
✅ Regression tests passing.
- Promises have landed in Apostrophe. Calling
toArray
,toObject
,toDistinct
ortoMongo
on an Apostrophe cursor without a callback will return a promise. That promise will resolve to the expected result.
⚡️ In addition,
docs.insert
,docs.update
,pieces.insert
,pieces.update
, andpages.insert
will all return a promise if invoked without a callback.These are the most frequently invoked functions in Apostrophe that formerly required callbacks.
As always with promises, be sure to catch errors with
.catch()
at some level.Note that the
await
keyword can now be used with these methods, as long as you're running Node.js 8.x or newer or using Babel to provide that language feature.Apostrophe's custom
Split
CKEditor toolbar control now works correctly in 2.x. You can give your users theSplit
control to allow them to break up a large rich text widget in order to insert other types of widget "in the middle." Note that the control name is now capitalized to match the way other CKEditor toolbar buttons are named.You may now specify
_url: 1
or_nameOfJoin: 1
in a projection when using Apostrophe'sfind()
methods. Native MongoDB projections naturally can't see these "computed properties" because they don't live in the database — they are computed "on the fly" after documents are fetched. However, Apostrophe now automatically adds the right underlying fields to the projection.
👍 Only
_url
and the names ofjoinByOne
orjoinByArray
fields are supported. It does not make sense to use a projection onpeople
to locate IDs that are actually attached toproducts
viajoinByOneReverse
orjoinByArrayReverse
.This feature does not conflict with legitimate uses of MongoDB projections because Apostrophe discards all properties beginning with
_
when writing to the database, except for_id
.The
length
property of an Apostropheattachment
object is now correctly populated with the original file size. Thanks to David Keita. Note that images are also made available in many scaled sizes. Also the original may be replaced with a correctly rotated version, in which caselength
will not match. So the most useful scenario for this property is likely to be in working with office formats, especially PDF which can sometimes be very large.🛠 Fixed bug in the
isEmpty
methods for areas and singletons. Thanks to David Keita.
- Promises have landed in Apostrophe. Calling