# NULL data in query result

**URL:** <https://community.prismic.io/t/null-data-in-query-result/1405>\
**Category:** Developing with Prismic\
**Tags:** php\
**Created:** [July 31, 2020, 4:02pm UTC](https://community.prismic.io/t/null-data-in-query-result/1405 "2020-07-31T16:02:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![lrmpham](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@lrmpham](https://community.prismic.io/u/lrmpham)\
**Post date:** [July 31, 2020, 4:02pm UTC](https://community.prismic.io/t/null-data-in-query-result/1405/1 "2020-07-31T16:02:00Z")

</div>

Hi,

I'm using the following query:  
$response = $api-\>query(  
Predicates::at('document.type', 'press\_releases'),  
['pageSize' =\> 50, 'page' =\> 1, 'orderings' =\> '[my.press\_releases.live\_date desc]' ]  
);  
Many of the results comes back with live\_date field being NULL even though there is valid data in them. Please advise.

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [July 31, 2020, 6:58pm UTC](https://community.prismic.io/t/null-data-in-query-result/1405/2 "2020-07-31T18:58:51Z")

</div>

Hello, @lrmpham welcome to the community forum!

- Are you checking that the endpoint is correct?
- Is this the only query that is causing you trouble?
- do you have more than one language in your repository that may contain Documents with an empty live\_date field?

---

<div class="post-metadata">

**Author:** ![lrmpham](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@lrmpham](https://community.prismic.io/u/lrmpham)\
**Post date:** [July 31, 2020, 7:24pm UTC](https://community.prismic.io/t/null-data-in-query-result/1405/3 "2020-07-31T19:24:58Z")

</div>

The endpoint is correct and it returns the press\_releases. It is only the live\_date field that is coming back as NULL. All the other fields of the press\_release are coming back ok.

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [August 3, 2020, 11:03am UTC](https://community.prismic.io/t/null-data-in-query-result/1405/4 "2020-08-03T11:03:35Z")

</div>

Hi,

Did you add the `live_date` field after the original documents were published? If so you will have to go back a re-publish these documents to trigger the population of the field in the API.

---

<div class="post-metadata">

**Author:** ![lrmpham](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@lrmpham](https://community.prismic.io/u/lrmpham)\
**Post date:** [August 3, 2020, 3:47pm UTC](https://community.prismic.io/t/null-data-in-query-result/1405/5 "2020-08-03T15:47:10Z")

</div>

No. Most of the press\_releases documents were imported into the system. Does that make a difference ?

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [August 3, 2020, 4:06pm UTC](https://community.prismic.io/t/null-data-in-query-result/1405/6 "2020-08-03T16:06:21Z")

</div>

It shouldn’t make a difference if the date format is correct. When you check the documents in the document writing room, is the date correct there?

---

<div class="post-metadata">

**Author:** ![lrmpham](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@lrmpham](https://community.prismic.io/u/lrmpham)\
**Post date:** [August 3, 2020, 5:31pm UTC](https://community.prismic.io/t/null-data-in-query-result/1405/7 "2020-08-03T17:31:09Z")

</div>

Yes. The date data is there and is correct.

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [August 4, 2020, 3:22am UTC](https://community.prismic.io/t/null-data-in-query-result/1405/8 "2020-08-04T03:22:08Z")

</div>

Thank you for letting us know about your case @lrmpham.

For the moment we don’t know what the issue could be so we’re passing this over to the dev team. We’ll get back to you with an answer as soon as possible.

Thanks

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [August 4, 2020, 5:48pm UTC](https://community.prismic.io/t/null-data-in-query-result/1405/12 "2020-08-04T17:48:36Z")

</div>

Hello again!

Sometimes, when doing imports, if there’s something incorrect in the fields, the data will be returned as null even if the published documents are correctly displayed. What you can do now, is go back to the documents with the Null values in the Date field, make a modification on the Date and re-publish.

---

<div class="post-metadata">

**Author:** ![lrmpham](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@lrmpham](https://community.prismic.io/u/lrmpham)\
**Post date:** [August 4, 2020, 6:12pm UTC](https://community.prismic.io/t/null-data-in-query-result/1405/13 "2020-08-04T18:12:18Z")

</div>

So looks like that did the trick. But that means I have to go through 200+ documents and manually update the field ? That is just the press\_releases documents. There are also 100+ articles documents that I imported also. Is there something you can do on your backend ?

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [August 5, 2020, 2:10pm UTC](https://community.prismic.io/t/null-data-in-query-result/1405/14 "2020-08-05T14:10:52Z")

</div>

Hey!

I totally understand that this could come as a hassle if you have too many documents with the same error. But yes, for the moment this would be the only way to correct your documents.

The dev team is now informed about this matter. If we release a fix for this we will communicate it here on the forum.

If you need anything else, let us know.  
Thanks

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [August 5, 2020, 2:29pm UTC](https://community.prismic.io/t/null-data-in-query-result/1405/15 "2020-08-05T14:29:32Z")

</div>

Hey,

I think the issue might have come when you first imported the documents, I think maybe the date field format was incorrect.

What you could try is to export all of the documents and re-import them to see if this triggers the correct date in the date field. Failing that you could export the documents and run a script which matches the UID from the original files that you imported and adds the date in the correct format, then when you do the import the date would be published correctly on all your docs.

---

<div class="post-metadata">

**Author:** ![lrmpham](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@lrmpham](https://community.prismic.io/u/lrmpham)\
**Post date:** [August 5, 2020, 4:25pm UTC](https://community.prismic.io/t/null-data-in-query-result/1405/16 "2020-08-05T16:25:02Z")

</div>

Just to confirm, if I export the press\_releases documents and re-import them, they will overwrite the documents that are in the repo and not create new ones ?

---

<div class="post-metadata">

**Author:** ![lrmpham](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@lrmpham](https://community.prismic.io/u/lrmpham)\
**Post date:** [August 5, 2020, 9:55pm UTC](https://community.prismic.io/t/null-data-in-query-result/1405/17 "2020-08-05T21:55:30Z")

</div>

So I did an export of an article, took the json and zipped it, upload the zip to import and it gave a warning that the live\_date field is not valid. Can you let me know what the date format should be ? Thanks.

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [August 6, 2020, 4:28am UTC](https://community.prismic.io/t/null-data-in-query-result/1405/18 "2020-08-06T04:28:08Z")

</div>

You need to make sure that the format of the JSON is the correct one. For a Date field, type with an API ID of “live\_date”. You need to provide a string with the date in the following format: “YYYY-MM-DD”.

If the date format is not correct, no value will be entered for the field.

```auto
"live_date": "2016-09-16"

```

[Read the full JSON reference for importing documents using the Import module](https://user-guides.prismic.io/en/articles/846084-import-full-import-reference).

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [September 24, 2020, 9:59pm UTC](https://community.prismic.io/t/null-data-in-query-result/1405/23 "2020-09-24T21:59:15Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [January 17, 2021, 7:59pm UTC](https://community.prismic.io/t/null-data-in-query-result/1405/24 "2021-01-17T19:59:59Z")

</div>



---

<div class="post-metadata">

**Author:** ![baholza](https://avatars.discourse-cdn.com/v4/letter/b/dbc845/32.png) [@baholza](https://community.prismic.io/u/baholza)\
**Post date:** [January 17, 2021, 8:03pm UTC](https://community.prismic.io/t/null-data-in-query-result/1405/25 "2021-01-17T20:03:23Z")

</div>

Same happened here with timestamp: no errors appeared when importing and all dates are correctly showing in the dashboard. Api returns null. imported +/- 400 documents, including files.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [June 13, 2021, 4:53am UTC](https://community.prismic.io/t/null-data-in-query-result/1405/30 "2021-06-13T04:53:22Z")

</div>



---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [June 25, 2021, 11:46pm UTC](https://community.prismic.io/t/null-data-in-query-result/1405/32 "2021-06-25T23:46:25Z")

</div>



[Next page](https://community.prismic.io/t/null-data-in-query-result/1405.md?page=2)
