Render a whole big collection with its nested arrays and objects


#1

Hi guys. I have a big document which has objects in it with nested arrays that have nested arrays with nested objects in them and so on. What are some best practices to show such collections?

Here is my collection example

{
	"_id" : "PM5JwjYWikk2sQz7F",
	"ipAdr" : "127.0.0.1",
	"connections" : [
		{
			"connID" : "N3WoCSDCAiFnFq9uD",
			"ipAdr" : "127.0.0.1",
			"httpHeads" : {
				"host" : "localhost:3000",
				"userAgent" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36",
				"realIP" : null
			},
			"connectedAt" : ISODate("2016-08-18T13:43:19.037Z"),
			"disconnectedAt" : ISODate("2016-08-18T13:43:42.607Z"),
			"clicks" : [
				{
					"clickedThis" : "Toggle",
					"clickedAt" : ISODate("2016-08-18T13:43:27.388Z")
				},
				{
					"clickedThis" : "Connections from this Ip",
					"clickedAt" : ISODate("2016-08-18T13:43:36.565Z")
				},
				{
					"clickedThis" : "Connections from this Ip",
					"clickedAt" : ISODate("2016-08-18T13:43:37.245Z")
				},
				{
					"clickedThis" : "<strong>IP:</strong> 127.0.0.1",
					"clickedAt" : ISODate("2016-08-18T13:43:37.787Z")
				},
				{
					"clickedThis" : "<strong>IP:</strong> 127.0.0.1",
					"clickedAt" : ISODate("2016-08-18T13:43:38.230Z")
				},
				{
					"clickedThis" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36",
					"clickedAt" : ISODate("2016-08-18T13:43:39.293Z")
				}
			]
		},
		{
			"connID" : "kb99LJ2EiRAZKsmaZ",
			"ipAdr" : "127.0.0.1",
			"httpHeads" : {
				"host" : "localhost:3000",
				"userAgent" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36",
				"realIP" : null
			},
			"connectedAt" : ISODate("2016-08-18T13:43:44.720Z"),
			"disconnectedAt" : ISODate("2016-08-18T13:43:53.699Z"),
			"clicks" : [
				{
					"clickedThis" : "Ip first registered:",
					"clickedAt" : ISODate("2016-08-18T13:43:46.777Z")
				},
				{
					"clickedThis" : "Toggle",
					"clickedAt" : ISODate("2016-08-18T13:43:47.775Z")
				},
				{
					"clickedThis" : "IPS",
					"clickedAt" : ISODate("2016-08-18T13:43:51.340Z")
				}
			]
		},
		{
			"connID" : "jhq3gnFyY3dqJrb5z",
			"ipAdr" : "127.0.0.1",
			"httpHeads" : {
				"host" : "localhost:3000",
				"userAgent" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36",
				"realIP" : null
			},
			"connectedAt" : ISODate("2016-08-18T13:43:55.565Z"),
			"disconnectedAt" : null,
			"clicks" : [
				{
					"clickedThis" : "Toggle",
					"clickedAt" : ISODate("2016-08-18T13:43:57.291Z")
				}
			]
		}
	],
	"createdAt" : ISODate("2016-08-18T13:43:19.037Z")
}

#2

{{#each}} and {{#which}} and more cool stuff))

{{#each goodItem}} 
       {{id}}
       {{title}}
        {{#each connections}} 
            {{conId}}
            {{ipAdr}}
         {{/each}}
{{/each}} 

More: http://docs.meteor.com/packages/spacebars.html