Skip to content

Instantly share code, notes, and snippets.

@acomito
Created August 11, 2019 12:54
Show Gist options
  • Save acomito/cc96e5ddbfc07af190f9681aedf09cab to your computer and use it in GitHub Desktop.
Save acomito/cc96e5ddbfc07af190f9681aedf09cab to your computer and use it in GitHub Desktop.
collections/Users/helpers.js
import Users from './model';
const getById = async id => {
try {
if (!id) return null;
// search for inventory item
let doc = await Users.findOne({ _id: id });
return doc; // firebase doesnt include the id, so tack it on
} catch (err) {
console.log(err);
}
};
export default {
getById
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment