If you’re wondering what version of MongoDB you’re running, here are 7 ways you can use to check.
Actually, some of these check your MongoDB server version, and some check your mongo shell version. In any case, let’s take a look.
Continue readingIf you’re wondering what version of MongoDB you’re running, here are 7 ways you can use to check.
Actually, some of these check your MongoDB server version, and some check your mongo shell version. In any case, let’s take a look.
Continue readingIn SQL Server, you can use the sp_rename
stored procedure to rename a user created object in the current database, including a primary key.
This can be handy if you’ve got a primary key that had its name automatically assigned, and you now want to give it a more readable name.
When you create a primary key without explicitly providing a name for it, SQL Server automatically delegates a name for it. Such names typically include a long numeric suffix, which makes it harder to remember. If you need to refer to that primary key (e.g. in your code, documentation, etc), such names can make your life more difficult. Fortunately, sp_rename
provides a quick and easy way to change this name.
In a previous article about creating a SQL Server Agent job with T-SQL, I demonstrated how to create a job with a single step.
In this article, I’ll show you how to create a job with multiple steps.
Continue readingA LEFT SEMI JOIN
is kind of a half-join. It returns any distinct values that are returned by both the query on the left and right sides of the query.
However, when using T-SQL in SQL Server, if you try to explicitly use LEFT SEMI JOIN
in your query, you’ll probably get the following error:
A LEFT ANTI SEMI JOIN
is a type of join that returns only those distinct rows in the left rowset that have no matching row in the right rowset.
But when using T-SQL in SQL Server, if you try to explicitly use LEFT ANTI SEMI JOIN
in your query, you’ll probably get the following error:
This article presents 5 ways to return the milliseconds portion from a Date object in MongoDB.
Continue readingThis article presents 5 ways to return the seconds portion from a Date object in MongoDB.
Continue readingThis article presents 5 ways to return the minutes portion from a Date object in MongoDB.
Continue readingMongoDB provides a good range of aggregation pipeline operators for working with dates, including operators that extract certain parts of dates, such as the year, month, day, hours, minutes, etc.
There are also a couple of MongoDB methods that enable you to iterate through a cursor, and apply a JavaScript function. You can therefore use JavaScript to extract date values and date parts, etc from a field as required.
This article presents 5 ways to return the hour portion from a Date object in MongoDB.
Continue readingIn MongoDB, you can use the $push
operator to append a value to an array.
This operator can be used with various modifiers, one of which is the $position
modifier. The $position
modifier allows you to specify the position within the array that you want to insert the new value.