If you’re getting a “longitude/latitude is out of bounds” error when trying to create a 2dsphere index in MongoDB, it could be due to your longitude and latitude coordinates being in the wrong order.
Continue readingCategory: DBMS
Database Management Systems
8 Ways to Add Days to a Date in MariaDB
MariaDB provides several ways to add a certain number of days to a given date. For example, you might want to add 10 days to a date, or 30 days, or even just 1 day. Fortunately, MariaDB makes this easy.
Here are 8 ways to add a number of days to a given date in MariaDB.
Continue readingHow to Check Whether an Index is Hidden in MongoDB
From MongoDB 4.4, it’s possible to hide an index from the query planner. This allows you to evaluate the potential impact of dropping an index without actually dropping the index.
You can use the getIndexes()
method to check whether or not an index is hidden. If an index is hidden, that index will display a hidden
field as having a value of true
(i.e. "hidden" : true
).
How to Reference JSON Keys that Contain Special Characters when using OPENJSON, JSON_QUERY, and JSON_VALUE (SQL Server)
If you’re using a T-SQL function such as OPENJSON()
, JSON_QUERY()
, or JSON_VALUE()
, you might be wary of any non-alphanumeric characters that might be in the JSON document that you’re working with. Especially if those special characters are in the key names, and you need to reference those key names.
How ADDTIME() Works in MariaDB
In MariaDB, ADDTIME()
is a built-in date and time function that adds an amount to a time or datetime expression.
It allows you to change a time or datetime expression by passing that expression, as well as a time expression to add to that expression. You can pass a negative amount if you need to subtract from the time expression.
Continue readingHow SUBTIME() Works in MariaDB
In MariaDB, SUBTIME()
is a built-in date and time function that subtracts an amount from a time or datetime expression.
It allows you to change a time or datetime expression by passing that expression, as well as a time expression to subtract from that expression. You can pass a negative amount if you need to add to the time expression.
Continue readingMariaDB Date and Time Units
Below is a full list of the date and time units that can be used in MariaDB.
Continue readingHow SUBDATE() Works in MariaDB
In MariaDB, SUBDATE()
is a built-in date and time function that subtracts an amount from a given date.
It allows you to change a date by specifying the date, the unit to subtract, and the amount to subtract. You can pass a negative amount in order to add to the date, instead of subtracting from it.
SUBDATE()
also has a shortcut syntax that allows you to specify the days to subtract.
How DATE_SUB() Works in MariaDB
In MariaDB, DATE_SUB()
is a built-in date and time function that allows you to subtract an amount from a date.
It allows you to change a date by specifying the date, the unit to subtract, and the amount to subtract. You can pass a negative amount in order to add to the date, instead of subtracting from it.
Continue readingHow ADDDATE() Works in MariaDB
In MariaDB, ADDDATE()
is a built-in date and time function that performs date arithmetic.
It allows you to change a date by specifying the date, the unit to add, and the amount to add. You can pass a negative amount if you need to subtract the date by a certain interval.
ADDDATE()
also has a shortcut syntax that allows you to add a given number of days to the date.