Skip to content

Commit 7f2746c

Browse files
authored
Merge pull request #229 from contentstack/development
README fix
2 parents e116b36 + aed70ee commit 7f2746c

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

README.md

+21-20
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,14 @@ To get a single entry, you need to specify the content type as well as the ID of
136136
```javascript
137137
const Query = Stack.ContentType('blog').Entry("<entry_uid>");
138138

139-
Query.fetch()
140-
.then(function success(entry) {
141-
console.log(entry.get('title')); // Retrieve field value by providing a field's uid
142-
console.log(entry.toJSON()); // Convert the entry result object to JSON
143-
}, function error(err) {
144-
// err object
145-
})
139+
Query
140+
.toJSON()
141+
.fetch()
142+
.then(function success(entry) {
143+
console.log(entry.get('title')); // Retrieve field value by providing a field's uid
144+
}, function error(err) {
145+
// err object
146+
})
146147
```
147148

148149
To retrieve multiple entries of a content type, you need to specify the content type uid. You can also specify search parameters to filter results.
@@ -151,19 +152,19 @@ To retrieve multiple entries of a content type, you need to specify the content
151152
const Query = Stack.ContentType('blog').Query();
152153

153154
Query
154-
.where("title", "welcome")
155-
.includeContentType()
156-
.includeCount()
157-
.toJSON()
158-
.find()
159-
.then(function success(result) {
160-
// result is array where -
161-
// result[0] =&gt; entry objects
162-
// result[result.length-1] =&gt; entry objects count included only when .includeCount() is queried.
163-
// result[1] =&gt; schema of the content type is included when .includeContentType() is queried.
164-
}, function error(err) {
165-
// err object
166-
})
155+
.where("title", "welcome")
156+
.includeContentType()
157+
.includeCount()
158+
.toJSON()
159+
.find()
160+
.then(function success(result) {
161+
// result is array where -
162+
// result[0] =&gt; entry objects
163+
// result[result.length-1] =&gt; entry objects count included only when .includeCount() is queried.
164+
// result[1] =&gt; schema of the content type is included when .includeContentType() is queried.
165+
}, function error(err) {
166+
// err object
167+
})
167168
```
168169

169170
#### Cache Policies

0 commit comments

Comments
 (0)