Re: [arangodb-google] Scoping FOR loop - to prevent duplicate INSERT

2025-08-28 Thread 'Simran Spiller' via ArangoDB
Instead of grouping by a constant, you can also apply a LIMIT for the same effect: LET array = [{title: "a"},{title: "b"}] FOR item IN array INSERT item INTO collection_1 LIMIT 1 INSERT {title: "c"} INTO collection_2 On Friday, May 16, 2025 at 1:47:45 PM UTC+2 mic...@arangodb.com wro

Re: [arangodb-google] Scoping FOR loop - to prevent duplicate INSERT

2025-05-16 Thread 'Michael Hackstein' via ArangoDB
Hi, For this particular query there are actually two more possibilities: >> LET array = [{title: "a"},{title: "b"}] >> FOR item IN array >> INSERT item INTO collection_1 >> INSERT {title: "c"} INTO collection_2 Could run as: INSERT {title: "c"} INTO collection_2 LET array = [{title: "a"},{t

[arangodb-google] Scoping FOR loop - to prevent duplicate INSERT

2025-05-16 Thread Klaas van der Molen
Hi, The query below inserts the object {title: "c"} *twice* in collection_2. However I want only *one* insert for the second collection. The question is how to scope the FOR loop in this case? Brackets are not accepted. LET array = [{title: "a"},{title: "b"}] FOR item IN array INSERT item