简体   繁体   English

如何从 WatermelonDB 中的 fetch() 查询结果中获取 ._raw 中的实际数据?

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

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.我可以使用 map 来获取 ._raw 数据,但我认为这不是一个好主意。 Any insight?有什么见解吗?

I don't see any issue with that as long as you don't mutate the returned objects as the docs here .只要您不像此处的文档那样改变返回的对象,我就看不出有任何问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM