I have an object like this that's generated from dynamic checkboxes in angular:
{"United States":true,"Canada":true,"Australia":false}
It works great as far as storing the values, but to be able to do database searches for the country values, I want to be able to convert it to an array to save it to the database (MongoDb/Mongoose) like:
["United States":true,"Canada":true,"Australia":false]
And then convert it back to the exact same type of object for the application.
What would be the easiest way to do this?
["United States":true,"Canada":true,"Australia":false]has the correct syntax for an array._.pairs(myObj)Assuming you want pairstruevalues you change the number of values you're storing & could not accurately recreate the original object. Why can't you store the object in Mongo? mongodb.github.io/node-mongodb-native/api-articles/…