I'm trying to upload my database to the heroku mongodbLab addon. My MongoDB version is 3.2.4 and my servers is 3.0.9. Mongoose is 4.4.6. However, when I run the command $ mongorestore -h myhostname -d mydatabase -u username -p password ~/tmp/mongodump/Loc8r to push the db to heroku I get the error:
building a list of collections to restore from /Users/user/tmp/mongodump/Loc8r dir
reading metadata for database.locations from /Users/user/tmp/mongodump/Loc8r/locations.metadata.json
restoring database.locations from /Users/user/tmp/mongodump/Loc8r/locations.bson
restoring indexes for collection database.locations from metadata
Failed: database.locations: error creating indexes for database.locations: createIndex error: exception: unsupported geo index version { 2dsphereIndexVersion : 2dsphereIndexVersion: 3 }, only support versions: [1,2]
How can I change the 2dsphereIndexVersion in my schema?
Here's my schema file for my db:
var mongoose = require('mongoose');
var openingTimesSchema = new mongoose.Schema({
days: {type: String, required: true},
opening: String,
closing: String,
closed: {type: Boolean, required: true}
});
var reviewSchema = new mongoose.Schema({
author: String,
rating: {type: Number, required: true, min: 0, max: 5},
reviewText: String,
createdOn: {type: Date, "default": Date.now}
});
var locationSchema = new mongoose.Schema({
name: {type:String, required: true},
address: String,
rating: {type: Number, "default": 0, min: 0, max: 5},
facilities: [String],
coords: {type: [Number], index: '2dsphere', "2dsphereIndexVersion": 2},
openingTimes: [openingTimesSchema],
reviews: [reviewSchema]
});
mongoose.model('Location', locationSchema);
As you can see I tried to change it by adding that attribute "2dsphereIndexVersion": 2. However, that didn't work. Anyone know how I can change this?
-EDIT-
I'm using mongoose to create the database with the schema above. I am trying to set the "2dsphereIndexVersion" to 2 because it's required by my servers version of MongoDB.