Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
prieyudaarvis opened this issue Sep 8, 2022 · 3 comments
Closed

Comments

@prieyudaarvis
Copy link

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?

@KrisLau
Copy link
Contributor

KrisLau commented Sep 8, 2022

remove the .fetch and the .active.collections. It should be:

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

@prieyudaarvis
Copy link
Author

removing .fetch and .active.collection will get:

TypeError: undefined is not a function

@KrisLau
Copy link
Contributor

KrisLau commented Sep 9, 2022

@prieyudaarvis What is your db variable pointing to? And also just try removing the fetch()

@radex radex closed this as completed Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants