Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8663045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:53:07+00:00 2026-06-12T16:53:07+00:00

On MongoDb 2.2.0 with PHP, I’m running this simple command: $collection->ensureIndex(array( ‘feed_nid’ => 1,

  • 0

On MongoDb 2.2.0 with PHP, I’m running this simple command:

  $collection->ensureIndex(array(
    'feed_nid' => 1,
    'guid' => 1,
  ), array(
    'unique' => TRUE,
    'dropDups' => TRUE,
  ));

It is supposed to create a new unique index, and drop duplicates. But MongoDb is stuck in a loop that goes on like this:

Thu Oct 11 00:31:09 [conn4] ERROR: can't commitNow from commitIfNeeded, as we are in local db lock
Thu Oct 11 00:31:10 [conn4] mongod.exe    ...\src\mongo\util\stacktrace.cpp(161)                           mongo::printStackTrace+0x3e
Thu Oct 11 00:31:10 [conn4] mongod.exe    ...\src\mongo\db\dur.cpp(279)                                    mongo::dur::DurableImpl::_aCommitIsNeeded+0x42a
Thu Oct 11 00:31:10 [conn4] mongod.exe    ...\src\mongo\db\index_update.cpp(401)                           mongo::BackgroundIndexBuildJob::addExistingToIndex+0x4c3
Thu Oct 11 00:31:10 [conn4] mongod.exe    ...\src\mongo\db\index_update.cpp(440)                           mongo::BackgroundIndexBuildJob::go+0xe0
Thu Oct 11 00:31:10 [conn4] mongod.exe    ...\src\mongo\db\index_update.cpp(501)                           mongo::buildAnIndex+0x321
Thu Oct 11 00:31:10 [conn4] mongod.exe    ...\src\mongo\db\pdfile.cpp(1356)                                mongo::insert_makeIndex+0x288
Thu Oct 11 00:31:10 [conn4] mongod.exe    ...\src\mongo\db\pdfile.cpp(1529)                                mongo::DataFileMgr::insert+0xbac
Thu Oct 11 00:31:10 [conn4] mongod.exe    ...\src\mongo\db\pdfile.cpp(1217)                                mongo::DataFileMgr::insertWithObjMod+0x48
Thu Oct 11 00:31:10 [conn4] mongod.exe    ...\src\mongo\db\instance.cpp(761)                               mongo::checkAndInsert+0xb7
Thu Oct 11 00:31:10 [conn4] mongod.exe    ...\src\mongo\db\instance.cpp(821)                               mongo::receivedInsert+0x790
Thu Oct 11 00:31:10 [conn4] mongod.exe    ...\src\mongo\db\instance.cpp(434)                               mongo::assembleResponse+0x5ff
Thu Oct 11 00:31:10 [conn4] mongod.exe    ...\src\mongo\db\db.cpp(192)                                     mongo::MyMessageHandler::process+0xf5
Thu Oct 11 00:31:10 [conn4] mongod.exe    ...\src\mongo\util\net\message_server_port.cpp(86)               mongo::pms::threadRun+0x59a
Thu Oct 11 00:31:10 [conn4] mongod.exe    ...\src\third_party\boost\libs\thread\src\win32\thread.cpp(180)  boost::`anonymous namespace'::thread_start_function+0x21
Thu Oct 11 00:31:10 [conn4] mongod.exe    f:\dd\vctools\crt_bld\self_64_amd64\crt\src\threadex.c(314)      _callthreadstartex+0x17
Thu Oct 11 00:31:10 [conn4] mongod.exe    f:\dd\vctools\crt_bld\self_64_amd64\crt\src\threadex.c(292)      _threadstartex+0x7f
Thu Oct 11 00:31:10 [conn4] kernel32.dll  

This stack is repeated thousands of times, without ever breaking that “local db lock”
This is on a test server with no traffic at all. Tried restarting MongoDb several times, to no avail.

Any help…?

-Additional info-

Running on WAMP with Apache 2.4.2, PHP 5.4.3 on Windows 7 64 bit. It’s the 64 bit MongoDb version from downloads.mongodb.org/win32/mongodb-win32-x86_64-2.2.0.zip

The problem also exists for MongoDb 2.0.7…

And when I use a tool like RockMongo to create the index (unique with dropDups), a different error shows:

E11000 duplicate key error index: local.fields_current.flatrow.$feed_nid_1_guid_1_unq dup key: { : 314, : "299435" }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:53:09+00:00Added an answer on June 12, 2026 at 4:53 pm

    Using ‘background: true’ seems to do the job!

      $collection->ensureIndex(array(
        'feed_nid' => 1,
        'guid' => 1,
      ), array(
        'unique' => TRUE,
        'dropDups' => TRUE,
        'background' => TRUE,
      ));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how to insert inner array in mongodb using php I run this command in
I have a small issue with the following MongoDB PHP script $collection = $this->db->retail_details;
MongoDB's PHP library allows me to connect to a collection like this ( from
I am using the MongoDB PHP Library and have the following query array Array
I am developing a webapp using PHP and MongoDB. In this app I keep
Dear everybody who can help, I have this PHP > MongoDB problem, I want
I'm using mongodb 2.1 and how to translate this query into php db.counter.aggregate([ {
Using PHP and MongoDB, i have a collection called users and another one called
I am creating an API using PHP and MongoDB. In this system I got
I have an applicaton written in PHP that retrieves files from mongoDB Grid collection,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.