[Answered ]-Initial_data for django running with MongoDB

2👍

From your error message, I assume you are using Django MongoDB Engine?

Your pk values must be valid ObjectIds, try using values like:

  • ‘000000000000000000000001’
  • ‘000000000000000000000002’
  • etc

You can get ObjectIds or check that you have correct values:

>>> from bson.objectid import ObjectId
>>> ObjectId()
  > ObjectId('52af59bac38f8420734d064d')
>>> ObjectId('000000000000000000000001')
  > ObjectId('000000000000000000000001')
>>> ObjectId('bad')
*error*

Leave a comment