In Moon Modeler you can use the copy and paste function to copy collections as well as individual fields. Previously it was only possible to copy entire collections, now you can conveniently copy one or more selected fields.
Let’s take a look at how to work with selected objects and what the paste inside option means.
Selections and copy & paste
Working with collections and individual fields without complex structure is easy. Just use the mouse and the CTRL (Command) key to expand the selection to multiple collections or multiple fields. Then use the keyboard shortcuts CTRL+C and CTRL+V as usual.
However, if you want to work with fields that are of type object (document), you can choose from several options.
Standard copy & paste
In the diagram you can select a field of type object (document) by clicking on this field in the collection, or by clicking on the graphic item representing the document (1). You can then right-click and select Copy (2) from the context menu.
Then choose the target collection or document. In the following example, the Vendor collection is selected as the target. Right-click on this object (1) and select Paste (2) from the context menu.
After this action, there is a new field Address in the Vendor collection, including the nested structure.
Copying larger structures is also easy. Sometimes you may want to paste part of a structure not into the main collection, but into an already defined document (nested object).
In this demonstration, we will start with a simple example. For the Customer collection, we will create a structure that contains a Billing address and also a Delivery address. The delivery address will be created by copying the billing address.
Select the billing address, right-click and select Copy.
Then right-click in the collection area and select Paste from the context menu.
Then just rename the newly created copy to delivery_address.
The copy we have in the clipboard can also be pasted into an existing field/document. Just select the field/document, right click and select Paste inside from the context menu.
Below you can see the newly inserted field (sub-document) renamed to primary_address.
The structure is seemingly complete.
Working with multiple items
Now let’s see how to insert a copy or move multiple items into an existing field/document.
In this part of the demonstration we will look at how to insert the billing address, delivery address and note into the contact field/document.
Select multiple fields from the collection using the mouse and the CTRL (Command) key. Right click on one of them and select Copy.
Then select the target field/document and choose Paste inside from the context menu.
The last step is to delete the original fields that are no longer needed.
The final database structure: