-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Document.save not saving the doc #1246
Comments
primary_key functionality must be revised. Also, keys may be compound, and if having two fields with primary_key in the same document, should it be considered as a compound key or invalid document definition? Clarifications are necessary to proceed. |
MongoDB allows for compound primary keys. Store an embedded document. There are very specific concerns relating to ensuring the order of the nested values is consistent between documents (or you lose out on sane ordering and range querying), and exact matching on the On the actual issue of this ticket: if any ID is present, MongoEngine has no way of knowing (without performing additional, potentially expensive queries) that the document is actually new and not present in the DB. |
Agreed with everything @amcgregor said. There's not much we can do here given that we don't know whether a document with a given ID already exists or not. Please use |
save
not saving the doc
Storing an instance with only
primary_key
set doesn't store the document. If any other field is set apart fromprimary_key
the document is getting stored.This must be happening as mongoengine assuming it to be update and as the instance has no other data set, hence mongoengine is getting northing in
updates
andremovals
.Eg:
I know I can use
force_insert
in save to make it work. but is this the desired behaviour?The text was updated successfully, but these errors were encountered: