# First Tİme CouchDB-Status:200 but no data displayed\[SOLVED\]

**URL:** <https://discuss.emberjs.com/t/first-time-couchdb-status-200-but-no-data-displayed-solved/12223>\
**Category:** Uncategorized\
**Created:** [January 8, 2017, 8:15pm UTC](https://discuss.emberjs.com/t/first-time-couchdb-status-200-but-no-data-displayed-solved/12223 "2017-01-08T20:15:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harun\_Tuncay](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/harun_tuncay/32/16888_2.png) [@Harun\_Tuncay](https://discuss.emberjs.com/u/Harun_Tuncay)\
**Post date:** [January 8, 2017, 8:15pm UTC](https://discuss.emberjs.com/t/first-time-couchdb-status-200-but-no-data-displayed-solved/12223/1 "2017-01-08T20:15:28Z")

</div>

Hi everyone, I am trying to use CouchDB for an app.I have installed it succesfully and generated an app.Installed add-ons “ember-pouch” and “add-cors-to-couchdb”.Configured the way “ember-pouch” document suggests.I have manually generated a document but it is not displaying.

You can see request made and console log it gives on pictures.Also when i hit save button, it doesn’t make any xhr request.I am alerting title to see if it is working, and it succesfully alerts title.

Here is the adapter;

```
import PouchDB from 'pouchdb';
import { Adapter } from 'ember-pouch';

 PouchDB.debug.enable('*');

var remote = new PouchDB('http://127.0.0.1:5984/offline');
var db = new PouchDB('local_pouch');

db.sync(remote, {
   live: true, // do a live, ongoing sync
   retry: true // retry if the conection is lost
});

export default Adapter.extend({
  db: db
});

```

As i said, this is my first time using couchDB.So if i have missed small detail, please reveal it to me and TIA.

 ![](https://us1.discourse-cdn.com/flex019/uploads/emberjs_public/original/2X/6/642cd8e4138c42fa88c5c36fc75421e9114087cd.png)

 ![](https://us1.discourse-cdn.com/flex019/uploads/emberjs_public/original/2X/b/b952586ded4fb063ad4d47661f187c5e92fe0319.png)

 ![](https://us1.discourse-cdn.com/flex019/uploads/emberjs_public/original/2X/6/6057a8b219c8c26f4ba80a5aeab52c242278a050.png)

---

<div class="post-metadata">

**Author:** ![broerse](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/broerse/32/9497_2.png) [@broerse](https://discuss.emberjs.com/u/broerse)\
**Post date:** [January 8, 2017, 9:06pm UTC](https://discuss.emberjs.com/t/first-time-couchdb-status-200-but-no-data-displayed-solved/12223/2 "2017-01-08T21:06:27Z")

</div>

Code looks good. The title is not written by ember-pouch because it is not in a `data` field.

 ![](https://us1.discourse-cdn.com/flex019/uploads/emberjs_public/original/2X/4/4264efd0c0f2284b7cc4bb8ab8e62e8c2a656ac1.jpg)

---

<div class="post-metadata">

**Author:** ![Harun\_Tuncay](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/harun_tuncay/32/16888_2.png) [@Harun\_Tuncay](https://discuss.emberjs.com/u/Harun_Tuncay)\
**Post date:** [January 9, 2017, 7:55am UTC](https://discuss.emberjs.com/t/first-time-couchdb-status-200-but-no-data-displayed-solved/12223/5 "2017-01-09T07:55:16Z")

</div>

I guess the mistake is, couchdb doesn’t know which document belongs to which object model. Check this source below.Data is displayed without a type.So it can’t say which model it belongs to.I manually add the type field but it didn’t solve it.BTW, i couldn’t generate data the way you show here.How can i add both “key” and “value” to a value field ?

 ![](https://us1.discourse-cdn.com/flex019/uploads/emberjs_public/original/2X/1/17c47d6a505839994d884607da49c631b6f7ed01.png)

---

<div class="post-metadata">

**Author:** ![broerse](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/broerse/32/9497_2.png) [@broerse](https://discuss.emberjs.com/u/broerse)\
**Post date:** [January 9, 2017, 8:26am UTC](https://discuss.emberjs.com/t/first-time-couchdb-status-200-but-no-data-displayed-solved/12223/6 "2017-01-09T08:26:00Z")

</div>

Just run something like this and see how the record is created:

[https://github.com/broerse/ember-cli-blog/blob/master/app/routes/posts.js#L17](https://github.com/broerse/ember-cli-blog/blob/master/app/routes/posts.js#L17)

---

<div class="post-metadata">

**Author:** ![Harun\_Tuncay](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/harun_tuncay/32/16888_2.png) [@Harun\_Tuncay](https://discuss.emberjs.com/u/Harun_Tuncay)\
**Post date:** [January 9, 2017, 9:44am UTC](https://discuss.emberjs.com/t/first-time-couchdb-status-200-but-no-data-displayed-solved/12223/8 "2017-01-09T09:44:04Z")

</div>

I got it working.All i did was taking “createInspection” action out of the routes file and put it in a controller.

May i ask, do we have to do it in controller? I see you have done it in the routes file but used setupController hook.Would it be a bad practice if i just use controller?

---

<div class="post-metadata">

**Author:** ![broerse](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/broerse/32/9497_2.png) [@broerse](https://discuss.emberjs.com/u/broerse)\
**Post date:** [January 9, 2017, 9:59am UTC](https://discuss.emberjs.com/t/first-time-couchdb-status-200-but-no-data-displayed-solved/12223/9 "2017-01-09T09:59:41Z")

</div>

Nice you got it working. The setupController hook has nothing to do with the actions here. It is some leftover code. Still need to cleanup 😉

Anticipating the future switch to [routable components](http://discuss.emberjs.com/t/when-will-routable-components-land/9448) I think it is better to do this actions on the router. I am sure it will not be much work to do this later and keep the actions on the controller.

---

<div class="post-metadata">

**Author:** ![Harun\_Tuncay](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/harun_tuncay/32/16888_2.png) [@Harun\_Tuncay](https://discuss.emberjs.com/u/Harun_Tuncay)\
**Post date:** [January 9, 2017, 10:02am UTC](https://discuss.emberjs.com/t/first-time-couchdb-status-200-but-no-data-displayed-solved/12223/10 "2017-01-09T10:02:34Z")

</div>

For my own sanity, i think i will use controller for a while, because it doesn’t respond to my route actions 🙂

Do you know what was interesting, when i use actions in route, XHR says 201 created but no record is actually there.Have you ever came across to this?

---

<div class="post-metadata">

**Author:** ![broerse](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/broerse/32/9497_2.png) [@broerse](https://discuss.emberjs.com/u/broerse)\
**Post date:** [January 9, 2017, 10:11am UTC](https://discuss.emberjs.com/t/first-time-couchdb-status-200-but-no-data-displayed-solved/12223/11 "2017-01-09T10:11:03Z")

</div>

> [@Harun\_Tuncay](#):
>
> Have you ever came across to this?

No. Should not be the case…
