- ReadOne and ReadMany
- CreateOne and CreateMany
- UpdateOne and UpdateMany
- DeleteOne and DeleteMany
Filter Property
The filter property within your Zeromagic queries provides a versatile set of operators to refine your data access. Here’s a breakdown of some commonly used operators:1. Logical Operators
@and, @or: Combine multiple filter conditions using the logical AND (and) or OR (or) operators within this property.
2. Sorting Operators
@sort: Specify sorting criteria within this property. Define the key to sort by (key) and the desired order ("order": "asc" for ascending, "desc" for descending).
3. Comparison Operators:
@eq: Exact equality check
@ne: Not equal check
@gt: Greater than comparison
@lt: Less than comparison
@gte: Greater than or equal to comparison.
@lte: Less than or equal to comparison.
4. String Matching:
@contains: Check if a string contains a specific substring.
@startswith: Check if a string starts with a specific prefix.
@in: Check if a value is within a provided list.
@nin: Check if a value is not within a provided list.
Sample Filter Query
Query-1
Query-2
Query Property
1. Container Property: (Required)
container: Specifies the name of the container on which the operation will be performed. This property allows developers to target specific data containers within their Zeromagic projects.
2. Field Selection
fields: Define a list of fields ["<field_1>", "<field_2>", "<field_3>"] you want to retrieve from the records. To represent aliases for a return field, provide input field as [{"<field_1>":"alias"}].
name is the original field and full_name is the alias name. So output will be like {"full_name":"Zeromagic"} instead of {"name":"Zeromagic"}. This is useful when you want to change the field name in the output.
3. Item Property: (Required for createOne method)
item: Represents a single item to be created within a data container. This property encapsulates the attributes and values of the item to be created, facilitating the creation of individual data records.
Create single item Query
4. Items Property: (Required for createMany method)
items: Contains an array of multiple items to be created within a data container. This property allows developers to create multiple data records simultaneously, streamlining the data creation process.
Create multiple items Query
5. Update Property: (Required for updateOne and updateMany method)
update: Defines the properties to be updated for a specific data record. This property specifies the attributes and new values to be applied to the selected record, enabling seamless data updates within Zeromagic containers.