0

Can SailsJS mongo adapter (sails-mongo) use existing mongo data (not created via SailsJS) with string _id fields (as opposed to ObjectIds)?

Dinana
  • 300
  • 3
  • 14

1 Answers1

0

Yes. You just need to set the autoPK setting to false in your model:

module.exports = {

    autoPK: false,
    attributes: {...},
    ...

}

See the full docs here.

sgress454
  • 24,870
  • 4
  • 74
  • 92
  • In fact i didn't need to, new records are still created with ObjectIDs, old ones are treated normally (until proven otherwise) with their string IDs! I'm proceeding with this and will answer my question when it's been tested thoroughly.. – Dinana May 14 '14 at 18:16