0

My data returned from Mongo looks like this:

[ { _id: 5510dcfb7ffb9ec87db017ca,
deviceId: '150622',
link: 'http://egauge15062.egaug.es/cgi-bin/egauge-show?S&s=0&n=6&C&Z=LST-8',
timestamp: 1427168502,
ct1: 3411,
ct2: 532,
ct3: 7,
ct4: 43,
ct5: 642 }, etc.........]

I am trying to archive the data into s3 and I need to convert that into string. I tried using .join and .tostring on the array and it ends up looking like this when I push it to the server.

[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]]

Any ideas how I can fix this.

1 Answer 1

2
JSON.stringify(obj)

Where obj is the javascript object you want to store.

This will return a serialised string which can then be re-used easily in javascript when you require it next, which looks exactly like what Mongo is returning you.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.