If you need to return the size of a document in MongoDB, you can use the following:
- The
$bsonSizeaggregation pipeline operator - The
Object.bsonSize()method
Below are examples of each approach.
If you need to return the size of a document in MongoDB, you can use the following:
$bsonSize aggregation pipeline operatorObject.bsonSize() methodBelow are examples of each approach.
If you need to add one or more microseconds to a datetime value in MariaDB, here are 8 options to consider.
In SQL Server, you can use OPENQUERY to execute a pass-through query on a linked server.
OPENQUERY is commonly referenced in the FROM clause of a query as if it were a table, but it can also be referenced as the target table of an INSERT, UPDATE, or DELETE statement.
This article presents an example of using OPENQUERY to do an INSERT pass-through query.
MongoDB provides a few ways to sort documents in a particular order. Each of these allow us to order the documents in ascending or descending order.
There’s also the option to order the results of a $text search – sorting by the computed textScore metadata in descending order.
Here are 3 ways to sort documents in MongoDB.
In SQL Server you can use the REPLACE() function to replace all occurrences of a string with another string.
The function accepts three arguments; the string that contains the string to be replaced, the string to be replaced, and the string to replace it.
MongoDB has a Date BSON type that allows you to store dates as dates.
You can also store dates as strings, if that’s what you need.
Taking it a step further, you can also convert a Date to a string.
This article presents three ways to convert a Date to a string in MongoDB.
In SQL Server, you can use the MONTH() function to convert a month name to its corresponding number.
SQL Server provides the STUFF() function that enables you to insert a string inside another string.
The function also allows you to specify the number of characters (if any) to delete from the original string in order to fit the new string.
There are several ways to return the year from a date in SQL Server. Here are three (or is it four?).
If you need to add one or more seconds to a datetime value in MariaDB, here are 8 options to consider.