Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here is the information about my development environment: •Microsoft Visual Studio Community 2015 •.NET Framework 4.6 •ASP.NET MVC assembly System.Web.Mvc Version= •MongoDB.Driver •Mongodb 3.0.6

From MongoDB client using DOS command prompt, I got the following:

C:\Program Files\MongoDB\Server\3.0\bin>mongo
 MongoDB shell version: 3.0.6
 connecting to: test
 > use foo
 switched to db foo
  > db.runCommand( { getLastError: 1, w: 2, wtimeout:5000 } )
       "connectionId" : 6,
       "n" : 0,
        "badGLE" : {
                "getLastError" : 1,
                "w" : 2,
                "wtimeout" : 5000
           "ok" : 0,
            "errmsg" : "cannot use 'w' > 1 when a host is not replicated",
           "code" : 2

-Is there something wrong with the way I configured mongoDB database on my development computer? -When I read the error message: "cannot use 'w' > 1 when a host is not replicated" it seems to me that mongoDB by default forces developers to have replica set. Is that correct?

I'm only using MongoDB for development on my local computer. I don't want to be forced to use a replica set. Is there any way to resolve the "cannot use 'w' > 1 when a host is not replicated" error message?

share|improve this question
up vote 1 down vote accepted

You shouldn't specify w: 2 in your query. You're asking to write to two nodes. See the docs here about write concern

share|improve this answer
Sorry, I'm a beginner in NoSql. Do we use the db.runCommand( { getLastError: 1, w: 1, wtimeout:5000 } ) command to show us errors caused by writes to MongoDB? – user1338998 Sep 25 '15 at 5:09
Yes. As you have written that with w: 1 should work for you. :) – Kassandry Sep 25 '15 at 5:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.