Skip to content

Conversation

Aschen
Copy link
Contributor

@Aschen Aschen commented Aug 8, 2018

What does this PR do?

When calling document.save() the SDK make a createOrReplace query to Kuzzle.
If the document was created without id, the query will fail.
This PR allow save() to call the create action instead of createOrReplace when no id is provided.

Fix: #303

How should this be manually tested?

  • Step 1 : Create and index and a collection: curl -X POST localhost:7512/test/_create && curl -X POST localhost:7512/test/test/_create
  • Step 2 : Use the sdk to create a document: kuzzle.collection('test', 'test').document({gordon: 'freeman'}).savePromise()

@Aschen Aschen self-assigned this Aug 8, 2018
@Aschen Aschen changed the base branch from master to 5.x August 8, 2018 13:27
@codecov-io
Copy link

Codecov Report

Merging #304 into 5.x will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##              5.x     #304      +/-   ##
==========================================
+ Coverage   98.34%   98.34%   +<.01%     
==========================================
  Files          17       17              
  Lines        2118     2119       +1     
==========================================
+ Hits         2083     2084       +1     
  Misses         35       35
Impacted Files Coverage Δ
src/Document.js 98.98% <100%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 712a79f...fdffa10. Read the comment docs.

@Aschen Aschen merged commit cd8cf61 into 5.x Aug 9, 2018
@Aschen Aschen deleted the 303-fix-document-save-without-id branch August 9, 2018 14:21
This was referenced Sep 12, 2018
scottinet added a commit that referenced this pull request Sep 13, 2018
* collection.create can be used with a mapping

* move eslint-loader to devDependencies

* update to webpack 4

* remove useless call to removeAllListeners

* mappings should be send inside a "body" property

* Fix document save when no id provided (#304)

* Allow to save document without ID

* fix eslint

* fix sinon

* Release 5.0.13

* dependencies update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants