-
Notifications
You must be signed in to change notification settings - Fork 30
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
Export custom data from object #165
Comments
Your transform function leaves an object behind: { _id: 'd4ebc3b9397ba3faaacde2bfb80089e7',
_rev: '2-69b7ea5b6dd7495ff3d26a0fc5630825',
personal:
{ firstName: 'Dan',
lastName: 'Denney',
dob: '12/26/87',
gender: 'male' },
firstName: 'Dan',
lastName: 'Denney',
company: 'Code School' } Try |
@glynnbird Thank you for instant reply Updated transform function by adding delete doc.personal Same result |
Actually @sandip-jadhav I know what's happening here. The transform step is only used on I'll use this issue to track progress. |
{ "_id": "d4ebc3b9397ba3faaacde2bfb80089e7", "_rev": "2-69b7ea5b6dd7495ff3d26a0fc5630825", "personal": { "firstName": "Dan", "lastName": "Denney", "dob": "12/26/87", "gender": "male" }, "work": { "workTitle": "Software Engineer", "workCompany": "Code School" }, "social": { "website": "dandenney.com", "emailId": "[email protected]", "twitter": "dandenney1", "facebook": "dandenney" }, "address": { "houseNumber": "52", "streetName": "main street", "city": "lodz", "country": "poland" } }
Want to export simple object with attributes firstName, lastName & company
We created transform.js
// example transformation function // -- remove leading and trailing quotes var x = function(doc) { doc.firstName = doc.personal.firstName; doc.lastName= doc.personal.lastName; doc.company = doc.work.workCompany; delete doc.work; delete doc.social; delete doc.address; return doc; } module.exports = x;
Command used
couchexport --url https://localhost:5984 --database tomtomdemo --delimiter "," --transform "D:\Places\optimus\Tools\couchDbTools\transform.js" > test_1.csv
Result : not expected
_id,personal,work,social,address
d4ebc3b9397ba3faaacde2bfb80089e7,[object Object],[object Object],[object Object],[object Object]
The text was updated successfully, but these errors were encountered: