remoteDS.add('MinixLi1986@bignerdranch.com',{emailAddress: 'MinixLi1986@bignerdranch.com',coffee: 'espresso'});

Hi!

I try following code to run from console

var remoteDS = new App.RemoteDataStore(“http://coffeerun-v2-rest-api.herokuapp.com/api/coffeeorders”);
remoteDS.add(‘MinixLi1986@bignerdranch.com’,{emailAddress: ‘MinixLi1986@bignerdranch.com’,coffee: ‘espresso’});

  1. {errmsg: “This MongoDB deployment does not support retryable… add retryWrites=false to your connection string.”, originalError: {…}, name: “MongoError”}

  2. errmsg: “This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string.”

  3. name: “MongoError”

  4. originalError: {operationTime: “6842960496937664513”, ok: 0, errmsg: “Transaction numbers are only allowed on storage engines that support document-level locking”, code: 20, codeName: “IllegalOperation”, …}

  5. proto: Object

Hello,

It seems I’m facing the same issue:

I try next code in the console:

var remoteDS = new App.RemoteDataStore("http://coffeerun-v2-rest-api.herokuapp.com/api/coffeeorders");
remoteDS.add('a@b.com', {emailAddress: 'c@j.com', coffee: 'black coffee'});

And I’m getting:

1. errmsg: "This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string."
2. name: "MongoError"

Thanks for your help!

Cristian Jáuregui S.

I am facing the same issue after disabling CORS in Chrome by launching it from the command line as follows:
C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-web-security --user-data-dir=~/chromeTemp

Is there a fix for this???

This chapter and the next are rather useless if not :frowning:

same error too. The status code is 200 yet. I have tried with Chrome and Firefox. Can any instructor of the book explain why?

Same issue. I imagine they have to fix this on their end when they connect to MongoDB. Maybe it’s a MongoDB 4.2 issue since the default for retryWrites is true?

If you want to start Chapter 14, and you want to use DataStore, you can use the following to mimic the Promise and delay of Ajax calls:

(function(window) {
  'use strict';

  var App = window.App || {};
  var Promise = window.Promise;

  function DataStore() {
    this.data = {};
  }

  function promiseResolvedWith(value, sideEffect) {
    var promise = new Promise(function(resolve, reject) {
      setTimeout(function() { // Add fake network delay
        if (sideEffect) {
          sideEffect();
        }
        resolve(value);
      }, 2000);
    });

    return promise;
  }

  DataStore.prototype.add = function(key, val) {
    return promiseResolvedWith(null, function() {
      this.data[key] = val;
      console.log('added data');
    }.bind(this));
  };

  DataStore.prototype.get = function(key) {
    return promiseResolvedWith(this.data[key], null);
  };

  DataStore.prototype.getAll = function() {
    return promiseResolvedWith(this.data, null);
  };

  DataStore.prototype.remove = function(key) {
    return promiseResolvedWith(null, function() {
      delete this.data[key];
      console.log('removed data');
    }.bind(this));
  };

  App.DataStore = DataStore;
  window.App = App;
})(window);