WatermelonDB
WatermelonDB copied to clipboard
How to get the actual data inside ._raw from fetch() query result?
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?
remove the .fetch
and the .active.collections
. It should be:
const rows = await db.get('messages').query(
Q.where('status', messagesStatus.ERROR)
)
removing .fetch and .active.collection will get:
TypeError: undefined is not a function
@prieyudaarvis What is your db
variable pointing to? And also just try removing the fetch()