Skip to content
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

Problematic replace with composite pk without _id #63

Open
pmaselkowski opened this issue Jan 15, 2016 · 3 comments
Open

Problematic replace with composite pk without _id #63

pmaselkowski opened this issue Jan 15, 2016 · 3 comments
Assignees

Comments

@pmaselkowski
Copy link
Member

pmaselkowski commented Jan 15, 2016

Mongo will anyway store _id, and as with composite PK without _id field it will simply insert new document each time. #59 Might be remedy, need to add pk's index definition to PrimaryKey annotation too.

@pmaselkowski
Copy link
Member Author

Workaround - use upsert

@pmaselkowski pmaselkowski self-assigned this Feb 11, 2016
@pmaselkowski
Copy link
Member Author

Maybe it should remove _id field if set externally and not present in model

@pmaselkowski
Copy link
Member Author

Example exception message when upserting model with different pk:

The _id field cannot be changed from {_id: ObjectId('5a670804a3d24b45714fb6f4')} to {_id: ObjectId('5a670804a3d24b45714fb6f5')}.

@pmaselkowski pmaselkowski changed the title Problematic save with composite pk without _id Problematic replace with composite pk without _id Jan 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant