My function definition looks like:
String#export(Schema, callback, options)
I want to convert the Mongoose Schema into a String CSV repersentation including any population specified in the options. You can assume that the population specification is stored like so:
options.population {
path: "_creator",
selection: "email"
}
The population should be repersented by the CSV like so:
_id, name, _creator_email
"123", "Foo", "foo@bar.com"
As you can see I want to prefix the path before the field.
Note: The callback definition is:
Void#callback(err,csv_string)
Can someone please provide me with code or a library capable of doing this. The function definitions can change if it makes it easier to accomplish.