Skip to content

Commit

Permalink
Merge pull request mrvautin#140 from matze1234/master
Browse files Browse the repository at this point in the history
create_index: JSON.parse instead of JSON.stringify
  • Loading branch information
mrvautin authored Feb 4, 2017
2 parents f92e5f9 + f47c849 commit 301061b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion routes/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ router.post('/collection/:conn/:db/:coll/create_index', function (req, res, next
var unique_bool = (req.body[1] === 'true');
var sparse_bool = (req.body[2] === 'true');
var options = {unique: unique_bool, background: true, sparse: sparse_bool};
mongo_db.collection(req.params.coll).createIndex(JSON.stringify(req.body[0]), options, function (err, index){
mongo_db.collection(req.params.coll).createIndex(JSON.parse(req.body[0]), options, function (err, index){
if(err){
console.error('Error creating index: ' + err);
res.status(400).json({'msg': req.i18n.__('Error creating Index') + ': ' + err});
Expand Down

0 comments on commit 301061b

Please sign in to comment.