function createMarker(token, title, description, location,
                      type, lat, lon, ttl, callback) {
  async.waterfall([function(next) {
    Session.findUser(token, next);
  }, function(userId, next) {
    //console.log(date.getTime());
    MarkerMongoModel.create({
      title       : title,
      description : description,
      location    : location,
      coordinates : {
        lat       : lat,
        lon       : lon
      },
      type        : type,
      owner       : userId,
      expireAt    : Date.now() + ttl
    }, next);
  }], function(err, marker) {
    if (err) {
      callback(err);
    } else {
      var callbackMarker = {
        id          : marker._id,
        title       : marker.title,
        description : marker.description,
        location    : marker.location,
        type        : marker.type,
        ttl         : marker.expireAt - Date.now(),
        lat         : marker.coordinates.lat,
        lon         : marker.coordinates.lon
      };
      callback(err, callbackMarker);
    }
  });

}
// Creates a new marker with required indexes.
Creates a new marker with required indexes.
Creates a new marker with required indexes .
function createMarker(token, title, description, location,
                      type, lat, lon, ttl, callback) {
  async.waterfall([function(next) {
    Session.findUser(token, next);
  }, function(userId, next) {
    MarkerMongoModel.create({
      title       : title,
      description : description,
      location    : location,
      coordinates : {
        lat       : lat,
        lon       : lon
      },
      type        : type,
      owner       : userId,
      expireAt    : Date.now() + ttl
    }, next);
  }], function(err, marker) {
    if (err) {
      callback(err);
    } else {
      var callbackMarker = {
        id          : marker._id,
        title       : marker.title,
        description : marker.description,
        location    : marker.location,
        type        : marker.type,
        ttl         : marker.expireAt - Date.now(),
        lat         : marker.coordinates.lat,
        lon         : marker.coordinates.lon
      };
      callback(err, callbackMarker);
    }
  });
}
function createMarker ( token , title , description , location , type , lat , lon , ttl , callback ) { async . waterfall ( [ function ( next ) { Session . findUser ( token , next ) ; } , function ( userId , next ) { MarkerMongoModel . create ( { title : title , description : description , location : location , coordinates : { lat : lat , lon : lon } , type : type , owner : userId , expireAt : Date . now ( ) + ttl } , next ) ; } ] , function ( err , marker ) { if ( err ) { callback ( err ) ; } else { var callbackMarker = { id : marker . _id , title : marker . title , description : marker . description , location : marker . location , type : marker . type , ttl : marker . expireAt - Date . now ( ) , lat : marker . coordinates . lat , lon : marker . coordinates . lon } ; callback ( err , callbackMarker ) ; } } ) ; }
Creates a new marker with required indexes.
Creates a new marker with required indexes .
//console.log(date.getTime());