, free & fully virtual. Register Now, free & fully virtual. Register Now

Nested object write problem. Possibly indexing related

I have been encountering an interesting problem for 2 months.

I have an object type which keeps a nested object inside. There are also several DBRefs in the main object. For the unknown circumstances (I do not exactly know how the problem is triggered), nested object begins to be not written under the main object for that collection during save operation. But DBRefs are fine.

So when I drop all the indexes for that collection and recreate them programmatically, this nested object problem is solved and begins to be written accordingly; until another time.

Do you have a suggestion/opinion about this?

Hi @kutay_YILDIRICI welcome to the community!

DBRefs are specific to a driver implementation, so it’s hard to tell what went wrong without knowing the driver you’re using. Could you post additional details:

  • What is the driver and the version you’re using
  • Could you share an example code that’s failing
  • Is this an intermittent issue, or is it happening all the time?

Best regards,

1 Like

Hi @kevinadi
My problem is not about DBRefs, it is about nested documents. Once it is triggered, it is happening all the time, until I drop and recreate the indexes. After recreating the indexes and restarting the apps, documents begin to be written successfully.
Let me give you an example:

In my “POST” collection:
Successful record:

	subPost --> nested document
	contact --> DBRef
	conversation --> DBRef

Fail record:

contact --> DBRef
conversation --> DBRef

We use Mongo Atlas, v3.6.20 with 3 replica sets
We were using Mongo Java driver: 3.8.2 , but upgraded to Mongo Java driver: 3.11.2 recently. For both drivers, we are experiencing that problem.