# query.include() not returning all fields

**URL:** <https://forum.wixstudio.com/t/query-include-not-returning-all-fields/1483>\
**Category:** Ask the community\
**Tags:** question, code, cms\
**Created:** [April 13, 2022, 1:56pm UTC](https://forum.wixstudio.com/t/query-include-not-returning-all-fields/1483 "2022-04-13T13:56:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ronald28659](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/ronald28659/32/22508_2.png) [@ronald28659](https://forum.wixstudio.com/u/ronald28659)\
**Post date:** [April 13, 2022, 1:56pm UTC](https://forum.wixstudio.com/t/query-include-not-returning-all-fields/1483/1 "2022-04-13T13:56:59Z")

</div>

I am using a database “AircoKeuzeHulp”, with one multi-reference field to another database “OfferteOnderdelen”.

When I use a query with include(), it stopped returning all the fields, it only returns the standard fields.  
When I query the same item directly, I do get all the fields returned.

var offerte = ( **await** wixData . query ( “Aircokeuzehulp” ). eq ( “\_id” , offerteID ) **.include(“offerteonderdelen”)**. find ()). items [0];  
console . log ( "offerte: " + JSON . stringify ( offerte ));

output doesn’t contain all fields:

```javascript

offerte:
 {"email": "anon",
 	"achternaam": "anon",
 	"_id": "414ae9b0-f4ea-498b-ba09-5ecc2bbfc450",
 	"_owner": "4d36071a-5a44-4bd2-9d8d-0ddc90882710",
 	"_createdDate": "2022-04-13T13:26:31.260Z",
 	"_updatedDate": "2022-04-13T13:26:31.260Z",
 	"offerteonderdelen": [{
 		"_id": "f974e6b7-30e3-49f2-bf00-18fb11b2929e",
 		"_owner": "4d36071a-5a44-4bd2-9d8d-0ddc90882710",
 		"_createdDate": "2022-04-13T13:26:14.354Z",
 		"_updatedDate": "2022-04-13T13:26:14.354Z"
 	}],
 ...
 	(other fields omitted)
 }

```

```
var test = (await wixData.query("OfferteOnderdelen").eq("_id", "f974e6b7-30e3-49f2-bf00-18fb11b2929e").find()).items[0];
console.log("test: " + JSON.stringify(test));

```

output does contain all fields:

```javascript

test: {
	"gekozenModel": "tundra",
	"model": "ec515f11-c8a3-415e-9e2a-05f48ffc2cd1",
	"_id": "f974e6b7-30e3-49f2-bf00-18fb11b2929e",
	"_owner": "4d36071a-5a44-4bd2-9d8d-0ddc90882710",
	"_createdDate": "2022-04-13T13:26:14.354Z",
	"_updatedDate": "2022-04-13T13:26:14.354Z",
	"breedte": "450",
	"hoogte": "260",
	"lengte": "300",
	"ruimte": "slaapkamer",
	"onderhoudscontract": true,
	"condenspomp": true
}

```

In the content manager, the reference column also doesnt show the value of the Primary field.

![](https://us1.discourse-cdn.com/wix/original/3X/8/3/83f1f7c1e66d58bbe2ef73f128a0c4b8392dc3c8.png)  
After re-opening the content manager it does:

![](https://us1.discourse-cdn.com/wix/original/3X/2/1/21f4f57e104b4decaddf809ab3aceefd4a426ad7.png)

What could be wrong?

---

<div class="post-metadata">

**Author:** ![J.D](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/j.d/32/7312_2.png) [@J.D](https://forum.wixstudio.com/u/J.D)\
**Post date:** [April 13, 2022, 5:25pm UTC](https://forum.wixstudio.com/t/query-include-not-returning-all-fields/1483/2 "2022-04-13T17:25:55Z")

</div>

The .include method (for multi-reference field) is limited to 50 referenced items.  
If you need to get more than the limit, you shouldn’t use .include() but queryReferenced( ). See:  
[https://www.wix.com/velo/reference/wix-data/queryreferenced](https://www.wix.com/velo/reference/wix-data/queryreferenced)

---

<div class="post-metadata">

**Author:** ![ronald28659](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/ronald28659/32/22508_2.png) [@ronald28659](https://forum.wixstudio.com/u/ronald28659)\
**Post date:** [April 14, 2022, 9:31am UTC](https://forum.wixstudio.com/t/query-include-not-returning-all-fields/1483/3 "2022-04-14T09:31:16Z")

</div>

Thanks for your reply.  
I am aware of that, but in this case there is only 1 referenced item.

From the docs:  
Each returned item can include up to 50 referenced items. If there are more than 50 referenced items, only 50 are returned when the query is run and the [partialIncludes](https://www.wix.com/velo/reference/wix-data/wixdataqueryresult/partialincludes) property of the returned [WixDataQueryResult](https://www.wix.com/velo/reference/wix-data/wixdataqueryresult) is true.

If there were more than 50 items, than the first 50 should be returned.

In my case: all the _ **items** _ are returned, but with only 4 _ **fields** _ : \_id, \_createdDate, updateDate and \_owner. All other _ **fields** _ have gone missing.  
That doesn’t seem to be expected behaviour of the 50 items-limit?

Also note the UI of the Content manager isn’t showing the referenced Primary Field as well on first load.

---

<div class="post-metadata">

**Author:** ![J.D](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/j.d/32/7312_2.png) [@J.D](https://forum.wixstudio.com/u/J.D)\
**Post date:** [April 14, 2022, 10:29am UTC](https://forum.wixstudio.com/t/query-include-not-returning-all-fields/1483/4 "2022-04-14T10:29:36Z")

</div>

@ronald28659 Sorry. You explained it perfectly in the first post. I didn’t read it carefully.  
But the offerte \_id value in the first example (with the include method) is not the same as in your direct query test. So maybe item 414ae9b0-f4ea-498b-ba09-5ecc2bbfc450 just doesn’t have a defined value for these fields. Are you sure they’re filled in (not only in live collection)?

---

<div class="post-metadata">

**Author:** ![ronald28659](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/ronald28659/32/22508_2.png) [@ronald28659](https://forum.wixstudio.com/u/ronald28659)\
**Post date:** [April 14, 2022, 12:16pm UTC](https://forum.wixstudio.com/t/query-include-not-returning-all-fields/1483/5 "2022-04-14T12:16:24Z")

</div>

@jonatandor35  
I am querying Offerte with offerte \_id 414ae9b0-f4ea-498b-ba09-5ecc2bbfc450

This offerte item has a multireferencefield called _offerteonderdelen_ , which is included by calling include().

This query returns referenced item with \_id f974e6b7-30e3-49f2-bf00-18fb11b2929e in the offerteonderdelen array

It is this same referenced item I am querying directly in the second example.

![](https://us1.discourse-cdn.com/wix/original/3X/c/e/ced8a37014c745414fc07d8b24e27642662640d3.png)  
(Offerteregels is the display name of offerteonderdelen)

 ![](https://us1.discourse-cdn.com/wix/original/3X/6/6/66efc6d55526c8e9d6f76182137f7f916e14089f.png)

---

<div class="post-metadata">

**Author:** ![J.D](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/j.d/32/7312_2.png) [@J.D](https://forum.wixstudio.com/u/J.D)\
**Post date:** [April 14, 2022, 1:45pm UTC](https://forum.wixstudio.com/t/query-include-not-returning-all-fields/1483/6 "2022-04-14T13:45:01Z")

</div>

@ronald28659 Now I got you, but I have no idea how to solve it.  
Maybe someone else?

---

<div class="post-metadata">

**Author:** ![marlowe-shaeffer](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/marlowe-shaeffer/32/669_2.png) [@marlowe-shaeffer](https://forum.wixstudio.com/u/marlowe-shaeffer)\
**Post date:** [April 15, 2022, 8:42pm UTC](https://forum.wixstudio.com/t/query-include-not-returning-all-fields/1483/7 "2022-04-15T20:42:25Z")

</div>

@ronald28659 Hi Ronald, the team has investigated, but we need more information. Please submit a ticket to [Customer Care](https://support.wix.com/en/article/contacting-wix-customer-care-for-support) and include your site URL, relevant databases, and the code in question. Share the ticket # in this thread and tag me so I can ensure it gets seen by the team quickly. Thanks!

---

<div class="post-metadata">

**Author:** ![ronald28659](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/ronald28659/32/22508_2.png) [@ronald28659](https://forum.wixstudio.com/u/ronald28659)\
**Post date:** [April 30, 2022, 10:00pm UTC](https://forum.wixstudio.com/t/query-include-not-returning-all-fields/1483/8 "2022-04-30T22:00:51Z")

</div>

It would seem this was related to a performance problem with the Content Manager in general. (some tables didn’t load at all, after a time out and later we received general 500 error messages when visiting our sites).  
After submitting a ticket, the problem disappeared as sudden as it appeared. Hopefully it won’t come back.
