Does anybody know whether the returned array from ...
# help
a
Does anybody know whether the returned array from a bulk insert will match the order of the data that was sent to the insert? I couldn't find this specified in the docs
n
Hello @anonymouslizard! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
o
Hi I'm not sure, but you can ``order`` the result by ``id``, so you're sure it has the right ``id`` (in case the ``id`` is a ``int``) @anonymouslizard
Otherwise you can order with any other field you would like to
a
The problem for me is that I need to do an insert (id is generated in the db), and then create a many-to-many row in another table. So i need to map items I sent over to the returned items. Unless order is guaranteed, I would need to send one by one or do something hacky in JavaScript
o
So in both cases you don't have difficulties, right? For the order, you can simply use the ``order`` method from the sdk, or simply use a javascript ``sort``
a
I will need to work something out with javascript
sort
-- problem is I don't need to order by
id
or any other field, I just need the order to match the order of the inserted array (which is in a random order)
s
I would like to learn more about how you are doing your many to many and how the order of these records would affect that.