Last active
December 18, 2019 14:14
-
-
Save indreklasn/ed2091e1c8787d3b3b0aa77add9f7532 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { client, q } from '../config/db' | |
const getAllNotes = client.query( | |
q.Paginate( | |
q.Match( | |
q.Ref('indexes/all_notes'))) | |
) | |
.then(response => { | |
const notesRefs = response.data | |
// create new query out of notes refs. | |
// https://docs.fauna.com/fauna/current/api/fql/ | |
const getAllProductDataQuery = notesRefs.map((ref) => { | |
return q.Get(ref) | |
}) | |
// query the refs | |
return client.query(getAllProductDataQuery).then((data) => data) | |
}) | |
.catch(error => console.warn('error', error.message)) | |
export default getAllNotes; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment