Pardon me if this is a completely idiotic question but I just can't figure it out.
Background Info
I'm writing an app in Node.js with the Express framework. I have a URI mapping designed to analyze some Twitter data for sentiment on a given subject in some aggregation units and return the GeoJSON object containing these results to the client.
Here are some details on the data.
- Aggregation units, States in the US, are stored as Points in a GeoJSON file, loaded via a
require
call. These points will later be used to make markers in a Leaflet map. - Tweets are stored in a MongoDB database, accessed using the
mongodb
driver.
And this is the process for altering these GeoJSON Points
- Load the GeoJSON with
require
- Query the MongoDB database for appropriate tweets
- Iterate over the features in the GeoJSON file
- Iterate over the tweets in the result set
- If the tweet is from within that feature
- Analyze the sentiment within
- Classify the feature using the sentiment
- Set
marker.properties.class
to the classification
- If the tweet is from within that feature
- Iterate over the tweets in the result set
- Write the altered GeoJSON to the response
Problem
So here's my problem, the GeoJSON I load with require
is never changed.
Question
Is data loaded via a call to require
mutable? If not, is there a simple way to make it mutable, and by that I mean simpler than copying the object?
Bonus question
Does anyone know why console.log()
doesn't work when a Node server is running with the Express framework? I swear it did before.