File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -17,10 +17,41 @@ Description
17
17
18
18
Creates a directory at the specified path. This method creates
19
19
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.
21
23
22
24
This method is equivalent to :command:`mkdir -p` with BSD or GNU utilities.
23
25
24
26
The :method:`mkdir()` method has the following parameter:
25
27
26
28
.. 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
+ { "exists" : true, "created" : true }
You can’t perform that action at this time.
0 commit comments