How to get the actual data inside ._raw from fetch() query result in WatermelonDB?

427 Views Asked by At

I do have a single query like this:

const rows = await db.active.collections
    .get('messages')
    .query(
            Q.where('status', messagesStatus.ERROR)
     ).fetch()

the results is like this:

[
  {
     __changes: Object,
   isEditing: false,
   preparedState: null,
   _raw: MY ACTUAL DATA
  },
  {
     __changes: Object,
   isEditing: false,
   preparedState: null,
   _raw: MY ACTUAL DATA
  },
]

I can use map to get ._raw data but I dont think it is a good idea. Any insight?

1

There are 1 best solutions below

1
MOUAD NASSRI On

I don't see any issue with that as long as you don't mutate the returned objects as the docs here.