diff --git a/src/jio/commands/command.js b/src/jio/commands/command.js
index f478787ea33b5cc6023816dea644fbc3319efbe6..ce56b6f816221513eba9af7b5f6728bc1ace8608 100644
--- a/src/jio/commands/command.js
+++ b/src/jio/commands/command.js
@@ -157,6 +157,16 @@ var command = function (spec, my) {
    * @param  {object} storage The storage.
    */
   that.validate = function (storage) {
+    if (typeof priv.doc._id === "string" && priv.doc._id.match(" ")) {
+      that.error({
+        "status": 21,
+        "statusText": "Invalid Document Id",
+        "error": "invalid_document_id",
+        "message": "The document id is invalid",
+        "reason": "The document id contains spaces"
+      });
+      return false;
+    }
     if (!that.validateState()) {
       return false;
     }