Skip to content

Commit

Permalink
adapting queries to mongoose 3
Browse files Browse the repository at this point in the history
  • Loading branch information
dontcallmedom committed Nov 14, 2012
1 parent 5f729b1 commit 9049dc1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions node.js/app.js
Expand Up @@ -177,6 +177,8 @@ everyauth.password
// Configuration
app.configure(function(){
emitter.setMaxListeners(0);
app.locals({baseurl: config.hosting.basepath, elapsedTime: elapsedTime, places: places});

app.use(express.logger());
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
Expand Down Expand Up @@ -453,7 +455,7 @@ function autoCheckout() {
if (config.schedule.autocheckout) {
var now = new Date();
if (now.getUTCHours() + parseInt(config.schedule.timezone_offset, 10) > parseInt(config.schedule.autocheckout, 10) / 100 || (now.getUTCHours() + parseInt(config.schedule.timezone_offset, 10) == parseInt(config.schedule.autocheckout, 10) / 100 && now.getUTCMinutes() >= parseInt(config.schedule.autocheckout,10) % 100)) {
People.find({"lastKnownPosition.shortname": {$ne: null}}, ["lastKnownPosition"], function(err, people) {
People.find({"lastKnownPosition.shortname": {$ne: null}}, "lastKnownPosition", function(err, people) {
if (err) {
console.log("autocheckout query error: " + err);
} else {
Expand Down Expand Up @@ -784,7 +786,7 @@ app.get('/locations/stream', function(req, res) {
emitter.on("tweet", function(tweet) {
People.findOne(
{"twitterAccount.id":tweet.user.id},
["lastKnownPosition"],
"lastKnownPosition",
function(err, indiv) {
res.write("event: tweet\n");
tweet.position = "";
Expand Down Expand Up @@ -1499,7 +1501,6 @@ app.all('/taxi/to', function (req, res) {
});*/
});

app.locals({baseurl: config.hosting.basepath, elapsedTime: elapsedTime, places: places});
app.set('port',3000);
server.listen( app.get('port'));
console.log("Express server listening on port %d in %s mode", app.get('port'), app.settings.env);
Expand Down
4 changes: 2 additions & 2 deletions node.js/imports.js
Expand Up @@ -57,7 +57,7 @@ exports.importUserList = function(auth, callback) {
return function (err) {
// assume duplicate key errors
if (err) {
Organization.findOne({slug: people.affiliationId}, ["_id", "name"], function(err, org) {
Organization.findOne({slug: people.affiliationId}, "_id name", function(err, org) {
if (org) {
people.affiliation = org._id;
}
Expand Down Expand Up @@ -168,7 +168,7 @@ exports.importRegistrationData = function(auth, callback) {
for (var p in eventRegistration[eventSlug]) {
var peopleSlug = eventRegistration[eventSlug][p];
People.findOne(
{slug: peopleSlug}, ["_id"],
{slug: peopleSlug}, "_id",
function(err, people) {
peopleCounter ++;
if (people) {
Expand Down

0 comments on commit 9049dc1

Please sign in to comment.