Save document should return True on update
See original GitHub issueAs mentioned in docs update
method should only be used for partial update, for full update save
method should be used, but save
method checks only a created field of ES response so it returns False
on a successful full update of a document.
An example of ES response that causes the problem:
{"_index":"indexnam","_type":"typename","_id":"randomid","_version":3,"result":"updated","_shards":{"total":2,"successful":1,"failed":0},"created":false}
Elasticsearch version (docker-elk):
"version" : {
"number" : "5.4.2",
"build_hash" : "929b078",
"build_date" : "2017-06-15T02:29:28.122Z",
"build_snapshot" : false,
"lucene_version" : "6.5.1"
}
Library version: 5.3.0
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Laravel save() method returning true but not updating records
This will return true. Save always returns true, unless update or save did not succeed (because user_id is not found or something like...
Read more >Mongoose v6.8.0: API docs
isObjectIdOrHexString() returns true only for ObjectId instances or 24 character hex strings, and will return false for numbers, documents, and strings of ...
Read more >Making decisions in your code — conditionals - MDN Web Docs
In this snippet, if the OR statement returns true , the NOT operator will negate it so that the overall expression returns false...
Read more >Upsert in MongoDB - GeeksforGeeks
If the value of this option is set to true and the document or documents found that match the specified query, then the...
Read more >Collections | Meteor API Docs
Increasing this will save CPU and mongo load at the expense of slower ... The number of affected documents will be returned from...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the feedback, I appreciate it. I know this part is confusing to people (and for very good reason).
If there is no exception it means it was successful, no need to check for anything.
Sorry for the confusion, by that sentence I meant
return True
if document was created andreturn False
if updated.