export function for mongoDB