Skip to content

Commit

Permalink
only check for specific mongo methods
Browse files Browse the repository at this point in the history
  • Loading branch information
officert committed Jan 27, 2016
1 parent 34e6021 commit ca7a9da
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ui/directives/query/queryCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ angular.module('app').controller('queryCtrl', [
name: expressionResult.mongoCollectionName
});

if (expressionResult.mongoMethodName !== 'find' && expressionResult.mongoMethodName !== 'aggregate' && expressionResult.mongoMethodName !== 'count') {
if (_isModifyingMongoMethod(expressionResult.mongoMethodName)) {
notificationService.success(`${expressionResult.mongoMethodName} was successful`);

return _evalExpression(`db.${expressionResult.mongoCollectionName}.find()`, $scope.database.collections);
Expand All @@ -132,6 +132,10 @@ angular.module('app').controller('queryCtrl', [
});
}

function _isModifyingMongoMethod(methodName) {
return methodName && (methodName === 'updateMany'|| methodName === 'updateById' || methodName === 'updateOne' || methodName === 'deleteMany' || methodName === 'deleteById' || methodName === 'deleteOne');
}

function _deleteDocument(doc) {
if (!doc) return;

Expand Down

0 comments on commit ca7a9da

Please sign in to comment.