Skip to content

Commit cceaab6

Browse files
committed
DOCS-9481: shell mkdir should return whether a new directory was created
1 parent 3ce5b78 commit cceaab6

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

source/reference/method/mkdir.txt

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,46 @@ Description
1717

1818
Creates a directory at the specified path. This method creates
1919
the entire path specified if the enclosing directory or
20-
directories do not already exit.
20+
directories do not already exit. The user running the
21+
:program:`mongo` shell must have permission to create directories in
22+
the specified path.
2123

2224
This method is equivalent to :command:`mkdir -p` with BSD or GNU utilities.
2325

2426
The :method:`mkdir()` method has the following parameter:
2527

2628
.. include:: /includes/apiargs/method-mkdir-param.rst
29+
30+
.. versionadded:: 3.4
31+
32+
:method:`mkdir()` returns a document with
33+
information about the result of the operation.
34+
35+
On success, :method:`mkdir()` returns the following:
36+
37+
.. code-block:: javascript
38+
39+
{ "exists" : true, "created" : true }
40+
41+
If the directory at the specified path already exists,
42+
:method:`mkdir()` returns the following:
43+
44+
.. code-block:: javascript
45+
46+
{ "exists" : true, "created" : false }
47+
48+
Example
49+
-------
50+
51+
The following command creates a directory called ``foo`` in the
52+
shell's current working directory.
53+
54+
.. code-block:: javascript
55+
56+
mkdir("foo")
57+
58+
The above command returns the following output:
59+
60+
.. code-block:: javascript
61+
62+
{ "exists" : true, "created" : true }

0 commit comments

Comments
 (0)