-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs for findById a bit unclear around query options #3977
Comments
|
This might not be clear since we don't document all query options seperate for all methods, not sure if we should do this or just refer to query, @janmeier? |
Right, but it also accepts a string as the first argument. In that case if On Saturday, June 20, 2015, Mick Hansen notifications@github.com wrote:
|
Yes the signature for findById is |
Please provide documentation for using findById. It has fewer google hits than... i dunno, fewer than anything. |
@akotranza passing the uuid in string form works for me. |
@akotranza https://github.com/sequelize/sequelize/blob/master/lib/model.js#L1400 - What's your issue specifically? Basically, findById takes a primary key value for a equality lookup as it's first argument, and all other finder options as it's second argument. |
Yes, I too have discovered that the uuid as string works. In general this project would benefit greatly from having at least one code example per method in the API. I appreciate the amount of detail in the User Guide section of the documentation, spreading even a 10th of that love over the API section would make using this library much less sticky. |
@akotranza Good suggestion, we might go about that :) Any assistance always welcome. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment 🙂 |
@mickhansen I know this is an old issue, but I'm wondering whether it's still the case that |
@tsheaff IIRC all options from calls are passed to |
@mickhansen : Many Thanks. EDIT : After own research : sequelize = new Sequelize(config.database, config.username, config.password, {
replication: {
write: {
host: AAA,
port: BBB,
username: CCC,
password: DDD
},
read: [{
host: EEE,
port: FFF,
username: GGG,
password: HHH
}]
},
logging: config.logging,
dialect: config.dialect,
pool: config.pool
}); Answer 3 : usage models.Something.create({
attr1: attr1Value,
attr2: attr2Value
attr3: attr3Value
}, {useMaster: true});
// or
models.Something.findOne({
where: {
attr1: attr1Value
},
useMaster, true
}); |
When doing something like models.Something.findOne({
where: {
attr1: attr1Value
},
useMaster, true
}); Do you have to use |
Is it allowed/supported to do
Or would I need to use the general case of findOne and specify my own
where
clause anduseMaster
within the options?The text was updated successfully, but these errors were encountered: