Sails version: v1.0.1
Node version: v8.9.4
NPM version: 5.6.0
DB adapter name: sails-mongo
DB adapter version: 1.0.0
Operating system: Mac
at start i see this on console:
debug: It looks like the default datastore for this app is sails-mongo,
debug: but the default primary key attribute (id) is not set up correctly.
debug: When using sails-mongo, primary keys MUST have columnName: '_id',
debug: and must _not_ have autoIncrement: true.
debug: Also, if dontUseObjectIds is not set to true for the model,
debug: then the type of the primary key must be string.
debug:
debug: We'll set this up for you this time...
debug:
info: ·• Auto-migrating... (alter)
info: Hold tight, this could take a moment.
info: ✓ Auto-migration complete.
The app is working but this message is annoying
How to avoid this?
Thanks
Hi @assiomatica! It looks like you missed a step or two when you created your issue. Please edit your comment (use the pencil icon at the top-right corner of the comment box) and fix the following:
As soon as those items are rectified, post a new comment (e.g. “Ok, fixed!”) below and we'll take a look. Thanks!
*If you feel this message is in error, or you want to debate the merits of my existence (sniffle), please contact [email protected]
ok, fixed
Sorry to be a hassle, but it looks like your issue is still missing some required info. Please double-check your initial comment and try again.
*If you feel this message is in error, or you want to debate the merits of my existence (sniffle), please contact [email protected]
ok, fixed
@assiomatica Thanks for posting, we'll take a look as soon as possible.
For help with questions about Sails, click here. If you’re interested in hiring @sailsbot and her minions in Austin, click here.
You need to set columnName: '_id' on your default id attribute in config/models.js, see here.
I see, thanks!
Il giorno ven 27 apr 2018 alle 12:09 Hamza notifications@github.com ha
scritto:
You need to set columnName: '_id' on your default id attribute in
config/models.js.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/balderdashy/sails/issues/4378#issuecomment-384927583,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACI2gT1pzIQ8zhD58utq7O-HTBfp6vOdks5tsu5zgaJpZM4Tp5tm
.>
Antonio Casula
mobile +41 (0)79 9692274
ch.linkedin.com/in/antoniocasula/
@hamzaOp thanks!
@hamzaOp
You need to set
columnName: '_id'on your defaultidattribute inconfig/models.js, see here.
It also says there:
The best way to change the primary key for your model is simply to customize the columnName of that default attribute.
which is what also causes the above message to appear.
Which, in turn, now makes me wonder what Sails is using as my primary key now, since it tells me:
We'll set this up for you this time...
But, I don't want Sails to set this up for me this time or any other, I want to freely chose my freaking primary key attribute, just like we were able to in 0.12
The amount of code I would need to change now, just because of this pointless limitation is staggering. Which means we will now never be able to upgrade Sails to 1.0..........
Most helpful comment
You need to set
columnName: '_id'on your defaultidattribute inconfig/models.js, see here.