sensu-plugins-mongodb-mrtrotl 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +1 -0
  3. data/LICENSE +22 -0
  4. data/README.md +27 -0
  5. data/bin/check-mongodb-metric.rb +144 -0
  6. data/bin/check-mongodb-query-count.rb +267 -0
  7. data/bin/check-mongodb.py +1644 -0
  8. data/bin/check-mongodb.rb +5 -0
  9. data/bin/metrics-mongodb-replication.rb +254 -0
  10. data/bin/metrics-mongodb.rb +133 -0
  11. data/lib/bson/__init__.py +1347 -0
  12. data/lib/bson/__pycache__/__init__.cpython-310.pyc +0 -0
  13. data/lib/bson/__pycache__/_helpers.cpython-310.pyc +0 -0
  14. data/lib/bson/__pycache__/binary.cpython-310.pyc +0 -0
  15. data/lib/bson/__pycache__/code.cpython-310.pyc +0 -0
  16. data/lib/bson/__pycache__/codec_options.cpython-310.pyc +0 -0
  17. data/lib/bson/__pycache__/dbref.cpython-310.pyc +0 -0
  18. data/lib/bson/__pycache__/decimal128.cpython-310.pyc +0 -0
  19. data/lib/bson/__pycache__/errors.cpython-310.pyc +0 -0
  20. data/lib/bson/__pycache__/int64.cpython-310.pyc +0 -0
  21. data/lib/bson/__pycache__/json_util.cpython-310.pyc +0 -0
  22. data/lib/bson/__pycache__/max_key.cpython-310.pyc +0 -0
  23. data/lib/bson/__pycache__/min_key.cpython-310.pyc +0 -0
  24. data/lib/bson/__pycache__/objectid.cpython-310.pyc +0 -0
  25. data/lib/bson/__pycache__/raw_bson.cpython-310.pyc +0 -0
  26. data/lib/bson/__pycache__/regex.cpython-310.pyc +0 -0
  27. data/lib/bson/__pycache__/son.cpython-310.pyc +0 -0
  28. data/lib/bson/__pycache__/timestamp.cpython-310.pyc +0 -0
  29. data/lib/bson/__pycache__/tz_util.cpython-310.pyc +0 -0
  30. data/lib/bson/_cbson.cpython-310-x86_64-linux-gnu.so +0 -0
  31. data/lib/bson/_helpers.py +41 -0
  32. data/lib/bson/binary.py +364 -0
  33. data/lib/bson/code.py +101 -0
  34. data/lib/bson/codec_options.py +414 -0
  35. data/lib/bson/codec_options.pyi +100 -0
  36. data/lib/bson/dbref.py +133 -0
  37. data/lib/bson/decimal128.py +314 -0
  38. data/lib/bson/errors.py +35 -0
  39. data/lib/bson/int64.py +39 -0
  40. data/lib/bson/json_util.py +874 -0
  41. data/lib/bson/max_key.py +55 -0
  42. data/lib/bson/min_key.py +55 -0
  43. data/lib/bson/objectid.py +286 -0
  44. data/lib/bson/py.typed +2 -0
  45. data/lib/bson/raw_bson.py +175 -0
  46. data/lib/bson/regex.py +135 -0
  47. data/lib/bson/son.py +208 -0
  48. data/lib/bson/timestamp.py +124 -0
  49. data/lib/bson/tz_util.py +52 -0
  50. data/lib/gridfs/__init__.py +1015 -0
  51. data/lib/gridfs/__pycache__/__init__.cpython-310.pyc +0 -0
  52. data/lib/gridfs/__pycache__/errors.cpython-310.pyc +0 -0
  53. data/lib/gridfs/__pycache__/grid_file.cpython-310.pyc +0 -0
  54. data/lib/gridfs/errors.py +33 -0
  55. data/lib/gridfs/grid_file.py +907 -0
  56. data/lib/gridfs/py.typed +2 -0
  57. data/lib/pymongo/__init__.py +185 -0
  58. data/lib/pymongo/__pycache__/__init__.cpython-310.pyc +0 -0
  59. data/lib/pymongo/__pycache__/_csot.cpython-310.pyc +0 -0
  60. data/lib/pymongo/__pycache__/aggregation.cpython-310.pyc +0 -0
  61. data/lib/pymongo/__pycache__/auth.cpython-310.pyc +0 -0
  62. data/lib/pymongo/__pycache__/auth_aws.cpython-310.pyc +0 -0
  63. data/lib/pymongo/__pycache__/bulk.cpython-310.pyc +0 -0
  64. data/lib/pymongo/__pycache__/change_stream.cpython-310.pyc +0 -0
  65. data/lib/pymongo/__pycache__/client_options.cpython-310.pyc +0 -0
  66. data/lib/pymongo/__pycache__/client_session.cpython-310.pyc +0 -0
  67. data/lib/pymongo/__pycache__/collation.cpython-310.pyc +0 -0
  68. data/lib/pymongo/__pycache__/collection.cpython-310.pyc +0 -0
  69. data/lib/pymongo/__pycache__/command_cursor.cpython-310.pyc +0 -0
  70. data/lib/pymongo/__pycache__/common.cpython-310.pyc +0 -0
  71. data/lib/pymongo/__pycache__/compression_support.cpython-310.pyc +0 -0
  72. data/lib/pymongo/__pycache__/cursor.cpython-310.pyc +0 -0
  73. data/lib/pymongo/__pycache__/daemon.cpython-310.pyc +0 -0
  74. data/lib/pymongo/__pycache__/database.cpython-310.pyc +0 -0
  75. data/lib/pymongo/__pycache__/driver_info.cpython-310.pyc +0 -0
  76. data/lib/pymongo/__pycache__/encryption.cpython-310.pyc +0 -0
  77. data/lib/pymongo/__pycache__/encryption_options.cpython-310.pyc +0 -0
  78. data/lib/pymongo/__pycache__/errors.cpython-310.pyc +0 -0
  79. data/lib/pymongo/__pycache__/event_loggers.cpython-310.pyc +0 -0
  80. data/lib/pymongo/__pycache__/hello.cpython-310.pyc +0 -0
  81. data/lib/pymongo/__pycache__/helpers.cpython-310.pyc +0 -0
  82. data/lib/pymongo/__pycache__/max_staleness_selectors.cpython-310.pyc +0 -0
  83. data/lib/pymongo/__pycache__/message.cpython-310.pyc +0 -0
  84. data/lib/pymongo/__pycache__/mongo_client.cpython-310.pyc +0 -0
  85. data/lib/pymongo/__pycache__/monitor.cpython-310.pyc +0 -0
  86. data/lib/pymongo/__pycache__/monitoring.cpython-310.pyc +0 -0
  87. data/lib/pymongo/__pycache__/network.cpython-310.pyc +0 -0
  88. data/lib/pymongo/__pycache__/ocsp_cache.cpython-310.pyc +0 -0
  89. data/lib/pymongo/__pycache__/ocsp_support.cpython-310.pyc +0 -0
  90. data/lib/pymongo/__pycache__/operations.cpython-310.pyc +0 -0
  91. data/lib/pymongo/__pycache__/periodic_executor.cpython-310.pyc +0 -0
  92. data/lib/pymongo/__pycache__/pool.cpython-310.pyc +0 -0
  93. data/lib/pymongo/__pycache__/pyopenssl_context.cpython-310.pyc +0 -0
  94. data/lib/pymongo/__pycache__/read_concern.cpython-310.pyc +0 -0
  95. data/lib/pymongo/__pycache__/read_preferences.cpython-310.pyc +0 -0
  96. data/lib/pymongo/__pycache__/response.cpython-310.pyc +0 -0
  97. data/lib/pymongo/__pycache__/results.cpython-310.pyc +0 -0
  98. data/lib/pymongo/__pycache__/saslprep.cpython-310.pyc +0 -0
  99. data/lib/pymongo/__pycache__/server.cpython-310.pyc +0 -0
  100. data/lib/pymongo/__pycache__/server_api.cpython-310.pyc +0 -0
  101. data/lib/pymongo/__pycache__/server_description.cpython-310.pyc +0 -0
  102. data/lib/pymongo/__pycache__/server_selectors.cpython-310.pyc +0 -0
  103. data/lib/pymongo/__pycache__/server_type.cpython-310.pyc +0 -0
  104. data/lib/pymongo/__pycache__/settings.cpython-310.pyc +0 -0
  105. data/lib/pymongo/__pycache__/socket_checker.cpython-310.pyc +0 -0
  106. data/lib/pymongo/__pycache__/srv_resolver.cpython-310.pyc +0 -0
  107. data/lib/pymongo/__pycache__/ssl_context.cpython-310.pyc +0 -0
  108. data/lib/pymongo/__pycache__/ssl_support.cpython-310.pyc +0 -0
  109. data/lib/pymongo/__pycache__/topology.cpython-310.pyc +0 -0
  110. data/lib/pymongo/__pycache__/topology_description.cpython-310.pyc +0 -0
  111. data/lib/pymongo/__pycache__/typings.cpython-310.pyc +0 -0
  112. data/lib/pymongo/__pycache__/uri_parser.cpython-310.pyc +0 -0
  113. data/lib/pymongo/__pycache__/write_concern.cpython-310.pyc +0 -0
  114. data/lib/pymongo/_cmessage.cpython-310-x86_64-linux-gnu.so +0 -0
  115. data/lib/pymongo/_csot.py +118 -0
  116. data/lib/pymongo/aggregation.py +229 -0
  117. data/lib/pymongo/auth.py +549 -0
  118. data/lib/pymongo/auth_aws.py +94 -0
  119. data/lib/pymongo/bulk.py +513 -0
  120. data/lib/pymongo/change_stream.py +457 -0
  121. data/lib/pymongo/client_options.py +302 -0
  122. data/lib/pymongo/client_session.py +1112 -0
  123. data/lib/pymongo/collation.py +224 -0
  124. data/lib/pymongo/collection.py +3204 -0
  125. data/lib/pymongo/command_cursor.py +353 -0
  126. data/lib/pymongo/common.py +984 -0
  127. data/lib/pymongo/compression_support.py +149 -0
  128. data/lib/pymongo/cursor.py +1345 -0
  129. data/lib/pymongo/daemon.py +141 -0
  130. data/lib/pymongo/database.py +1202 -0
  131. data/lib/pymongo/driver_info.py +42 -0
  132. data/lib/pymongo/encryption.py +884 -0
  133. data/lib/pymongo/encryption_options.py +221 -0
  134. data/lib/pymongo/errors.py +365 -0
  135. data/lib/pymongo/event_loggers.py +221 -0
  136. data/lib/pymongo/hello.py +219 -0
  137. data/lib/pymongo/helpers.py +259 -0
  138. data/lib/pymongo/max_staleness_selectors.py +114 -0
  139. data/lib/pymongo/message.py +1440 -0
  140. data/lib/pymongo/mongo_client.py +2144 -0
  141. data/lib/pymongo/monitor.py +440 -0
  142. data/lib/pymongo/monitoring.py +1801 -0
  143. data/lib/pymongo/network.py +311 -0
  144. data/lib/pymongo/ocsp_cache.py +87 -0
  145. data/lib/pymongo/ocsp_support.py +372 -0
  146. data/lib/pymongo/operations.py +507 -0
  147. data/lib/pymongo/periodic_executor.py +183 -0
  148. data/lib/pymongo/pool.py +1660 -0
  149. data/lib/pymongo/py.typed +2 -0
  150. data/lib/pymongo/pyopenssl_context.py +383 -0
  151. data/lib/pymongo/read_concern.py +75 -0
  152. data/lib/pymongo/read_preferences.py +609 -0
  153. data/lib/pymongo/response.py +109 -0
  154. data/lib/pymongo/results.py +217 -0
  155. data/lib/pymongo/saslprep.py +113 -0
  156. data/lib/pymongo/server.py +247 -0
  157. data/lib/pymongo/server_api.py +170 -0
  158. data/lib/pymongo/server_description.py +285 -0
  159. data/lib/pymongo/server_selectors.py +153 -0
  160. data/lib/pymongo/server_type.py +32 -0
  161. data/lib/pymongo/settings.py +159 -0
  162. data/lib/pymongo/socket_checker.py +104 -0
  163. data/lib/pymongo/srv_resolver.py +126 -0
  164. data/lib/pymongo/ssl_context.py +39 -0
  165. data/lib/pymongo/ssl_support.py +99 -0
  166. data/lib/pymongo/topology.py +890 -0
  167. data/lib/pymongo/topology_description.py +639 -0
  168. data/lib/pymongo/typings.py +39 -0
  169. data/lib/pymongo/uri_parser.py +624 -0
  170. data/lib/pymongo/write_concern.py +129 -0
  171. data/lib/pymongo-4.2.0.dist-info/INSTALLER +1 -0
  172. data/lib/pymongo-4.2.0.dist-info/LICENSE +201 -0
  173. data/lib/pymongo-4.2.0.dist-info/METADATA +250 -0
  174. data/lib/pymongo-4.2.0.dist-info/RECORD +167 -0
  175. data/lib/pymongo-4.2.0.dist-info/REQUESTED +0 -0
  176. data/lib/pymongo-4.2.0.dist-info/WHEEL +6 -0
  177. data/lib/pymongo-4.2.0.dist-info/top_level.txt +3 -0
  178. data/lib/sensu-plugins-mongodb/metrics.rb +391 -0
  179. data/lib/sensu-plugins-mongodb/version.rb +9 -0
  180. data/lib/sensu-plugins-mongodb.rb +1 -0
  181. metadata +407 -0
@@ -0,0 +1,129 @@
1
+ # Copyright 2014-present MongoDB, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """Tools for working with write concerns."""
16
+
17
+ from typing import Any, Dict, Optional, Union
18
+
19
+ from pymongo.errors import ConfigurationError
20
+
21
+
22
+ class WriteConcern(object):
23
+ """WriteConcern
24
+
25
+ :Parameters:
26
+ - `w`: (integer or string) Used with replication, write operations
27
+ will block until they have been replicated to the specified number
28
+ or tagged set of servers. `w=<integer>` always includes the replica
29
+ set primary (e.g. w=3 means write to the primary and wait until
30
+ replicated to **two** secondaries). **w=0 disables acknowledgement
31
+ of write operations and can not be used with other write concern
32
+ options.**
33
+ - `wtimeout`: (integer) Used in conjunction with `w`. Specify a value
34
+ in milliseconds to control how long to wait for write propagation
35
+ to complete. If replication does not complete in the given
36
+ timeframe, a timeout exception is raised.
37
+ - `j`: If ``True`` block until write operations have been committed
38
+ to the journal. Cannot be used in combination with `fsync`. Write
39
+ operations will fail with an exception if this option is used when
40
+ the server is running without journaling.
41
+ - `fsync`: If ``True`` and the server is running without journaling,
42
+ blocks until the server has synced all data files to disk. If the
43
+ server is running with journaling, this acts the same as the `j`
44
+ option, blocking until write operations have been committed to the
45
+ journal. Cannot be used in combination with `j`.
46
+ """
47
+
48
+ __slots__ = ("__document", "__acknowledged", "__server_default")
49
+
50
+ def __init__(
51
+ self,
52
+ w: Optional[Union[int, str]] = None,
53
+ wtimeout: Optional[int] = None,
54
+ j: Optional[bool] = None,
55
+ fsync: Optional[bool] = None,
56
+ ) -> None:
57
+ self.__document: Dict[str, Any] = {}
58
+ self.__acknowledged = True
59
+
60
+ if wtimeout is not None:
61
+ if not isinstance(wtimeout, int):
62
+ raise TypeError("wtimeout must be an integer")
63
+ if wtimeout < 0:
64
+ raise ValueError("wtimeout cannot be less than 0")
65
+ self.__document["wtimeout"] = wtimeout
66
+
67
+ if j is not None:
68
+ if not isinstance(j, bool):
69
+ raise TypeError("j must be True or False")
70
+ self.__document["j"] = j
71
+
72
+ if fsync is not None:
73
+ if not isinstance(fsync, bool):
74
+ raise TypeError("fsync must be True or False")
75
+ if j and fsync:
76
+ raise ConfigurationError("Can't set both j and fsync at the same time")
77
+ self.__document["fsync"] = fsync
78
+
79
+ if w == 0 and j is True:
80
+ raise ConfigurationError("Cannot set w to 0 and j to True")
81
+
82
+ if w is not None:
83
+ if isinstance(w, int):
84
+ if w < 0:
85
+ raise ValueError("w cannot be less than 0")
86
+ self.__acknowledged = w > 0
87
+ elif not isinstance(w, str):
88
+ raise TypeError("w must be an integer or string")
89
+ self.__document["w"] = w
90
+
91
+ self.__server_default = not self.__document
92
+
93
+ @property
94
+ def is_server_default(self) -> bool:
95
+ """Does this WriteConcern match the server default."""
96
+ return self.__server_default
97
+
98
+ @property
99
+ def document(self) -> Dict[str, Any]:
100
+ """The document representation of this write concern.
101
+
102
+ .. note::
103
+ :class:`WriteConcern` is immutable. Mutating the value of
104
+ :attr:`document` does not mutate this :class:`WriteConcern`.
105
+ """
106
+ return self.__document.copy()
107
+
108
+ @property
109
+ def acknowledged(self) -> bool:
110
+ """If ``True`` write operations will wait for acknowledgement before
111
+ returning.
112
+ """
113
+ return self.__acknowledged
114
+
115
+ def __repr__(self):
116
+ return "WriteConcern(%s)" % (", ".join("%s=%s" % kvt for kvt in self.__document.items()),)
117
+
118
+ def __eq__(self, other: Any) -> bool:
119
+ if isinstance(other, WriteConcern):
120
+ return self.__document == other.document
121
+ return NotImplemented
122
+
123
+ def __ne__(self, other: Any) -> bool:
124
+ if isinstance(other, WriteConcern):
125
+ return self.__document != other.document
126
+ return NotImplemented
127
+
128
+
129
+ DEFAULT_WRITE_CONCERN = WriteConcern()
@@ -0,0 +1 @@
1
+ pip
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,250 @@
1
+ Metadata-Version: 2.1
2
+ Name: pymongo
3
+ Version: 4.2.0
4
+ Summary: Python driver for MongoDB <http://www.mongodb.org>
5
+ Home-page: http://github.com/mongodb/mongo-python-driver
6
+ Author: The MongoDB Python Team
7
+ License: Apache License, Version 2.0
8
+ Keywords: mongo,mongodb,pymongo,gridfs,bson
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Operating System :: MacOS :: MacOS X
13
+ Classifier: Operating System :: Microsoft :: Windows
14
+ Classifier: Operating System :: POSIX
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.7
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: Implementation :: CPython
22
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
23
+ Classifier: Topic :: Database
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.7
26
+ License-File: LICENSE
27
+ Provides-Extra: aws
28
+ Requires-Dist: pymongo-auth-aws (<2.0.0) ; extra == 'aws'
29
+ Provides-Extra: encryption
30
+ Requires-Dist: pymongocrypt (<2.0.0,>=1.3.0) ; extra == 'encryption'
31
+ Provides-Extra: gssapi
32
+ Requires-Dist: pykerberos ; extra == 'gssapi'
33
+ Provides-Extra: ocsp
34
+ Requires-Dist: pyopenssl (>=17.2.0) ; extra == 'ocsp'
35
+ Requires-Dist: requests (<3.0.0) ; extra == 'ocsp'
36
+ Requires-Dist: service-identity (>=18.1.0) ; extra == 'ocsp'
37
+ Provides-Extra: snappy
38
+ Requires-Dist: python-snappy ; extra == 'snappy'
39
+ Provides-Extra: srv
40
+ Requires-Dist: dnspython (<3.0.0,>=1.16.0) ; extra == 'srv'
41
+ Provides-Extra: zstd
42
+ Requires-Dist: zstandard ; extra == 'zstd'
43
+
44
+ =======
45
+ PyMongo
46
+ =======
47
+ :Info: See `the mongo site <http://www.mongodb.org>`_ for more information. See `GitHub <http://github.com/mongodb/mongo-python-driver>`_ for the latest source.
48
+ :Documentation: Available at `pymongo.readthedocs.io <https://pymongo.readthedocs.io/en/stable/>`_
49
+ :Author: The MongoDB Python Team
50
+
51
+ About
52
+ =====
53
+
54
+ The PyMongo distribution contains tools for interacting with MongoDB
55
+ database from Python. The ``bson`` package is an implementation of
56
+ the `BSON format <http://bsonspec.org>`_ for Python. The ``pymongo``
57
+ package is a native Python driver for MongoDB. The ``gridfs`` package
58
+ is a `gridfs
59
+ <https://github.com/mongodb/specifications/blob/master/source/gridfs/gridfs-spec.rst/>`_
60
+ implementation on top of ``pymongo``.
61
+
62
+ PyMongo supports MongoDB 3.6, 4.0, 4.2, 4.4, and 5.0.
63
+
64
+ Support / Feedback
65
+ ==================
66
+
67
+ For issues with, questions about, or feedback for PyMongo, please look into
68
+ our `support channels <https://support.mongodb.com/welcome>`_. Please
69
+ do not email any of the PyMongo developers directly with issues or
70
+ questions - you're more likely to get an answer on the `MongoDB Community
71
+ Forums <https://developer.mongodb.com/community/forums/tag/python-driver>`_.
72
+
73
+ Bugs / Feature Requests
74
+ =======================
75
+
76
+ Think you’ve found a bug? Want to see a new feature in PyMongo? Please open a
77
+ case in our issue management tool, JIRA:
78
+
79
+ - `Create an account and login <https://jira.mongodb.org>`_.
80
+ - Navigate to `the PYTHON project <https://jira.mongodb.org/browse/PYTHON>`_.
81
+ - Click **Create Issue** - Please provide as much information as possible about the issue type and how to reproduce it.
82
+
83
+ Bug reports in JIRA for all driver projects (i.e. PYTHON, CSHARP, JAVA) and the
84
+ Core Server (i.e. SERVER) project are **public**.
85
+
86
+ How To Ask For Help
87
+ -------------------
88
+
89
+ Please include all of the following information when opening an issue:
90
+
91
+ - Detailed steps to reproduce the problem, including full traceback, if possible.
92
+ - The exact python version used, with patch level::
93
+
94
+ $ python -c "import sys; print(sys.version)"
95
+
96
+ - The exact version of PyMongo used, with patch level::
97
+
98
+ $ python -c "import pymongo; print(pymongo.version); print(pymongo.has_c())"
99
+
100
+ - The operating system and version (e.g. Windows 7, OSX 10.8, ...)
101
+ - Web framework or asynchronous network library used, if any, with version (e.g.
102
+ Django 1.7, mod_wsgi 4.3.0, gevent 1.0.1, Tornado 4.0.2, ...)
103
+
104
+ Security Vulnerabilities
105
+ ------------------------
106
+
107
+ If you’ve identified a security vulnerability in a driver or any other
108
+ MongoDB project, please report it according to the `instructions here
109
+ <https://www.mongodb.com/docs/manual/tutorial/create-a-vulnerability-report/>`_.
110
+
111
+ Installation
112
+ ============
113
+
114
+ PyMongo can be installed with `pip <http://pypi.python.org/pypi/pip>`_::
115
+
116
+ $ python -m pip install pymongo
117
+
118
+ Or ``easy_install`` from
119
+ `setuptools <http://pypi.python.org/pypi/setuptools>`_::
120
+
121
+ $ python -m easy_install pymongo
122
+
123
+ You can also download the project source and do::
124
+
125
+ $ python setup.py install
126
+
127
+ Do **not** install the "bson" package from pypi. PyMongo comes with its own
128
+ bson package; doing "easy_install bson" installs a third-party package that
129
+ is incompatible with PyMongo.
130
+
131
+ Dependencies
132
+ ============
133
+
134
+ PyMongo supports CPython 3.7+ and PyPy3.7+.
135
+
136
+ Optional dependencies:
137
+
138
+ GSSAPI authentication requires `pykerberos
139
+ <https://pypi.python.org/pypi/pykerberos>`_ on Unix or `WinKerberos
140
+ <https://pypi.python.org/pypi/winkerberos>`_ on Windows. The correct
141
+ dependency can be installed automatically along with PyMongo::
142
+
143
+ $ python -m pip install "pymongo[gssapi]"
144
+
145
+ MONGODB-AWS authentication requires `pymongo-auth-aws
146
+ <https://pypi.org/project/pymongo-auth-aws/>`_::
147
+
148
+ $ python -m pip install "pymongo[aws]"
149
+
150
+ Support for mongodb+srv:// URIs requires `dnspython
151
+ <https://pypi.python.org/pypi/dnspython>`_::
152
+
153
+ $ python -m pip install "pymongo[srv]"
154
+
155
+ OCSP (Online Certificate Status Protocol) requires `PyOpenSSL
156
+ <https://pypi.org/project/pyOpenSSL/>`_, `requests
157
+ <https://pypi.org/project/requests/>`_, `service_identity
158
+ <https://pypi.org/project/service_identity/>`_ and may
159
+ require `certifi
160
+ <https://pypi.python.org/pypi/certifi>`_::
161
+
162
+ $ python -m pip install "pymongo[ocsp]"
163
+
164
+ Wire protocol compression with snappy requires `python-snappy
165
+ <https://pypi.org/project/python-snappy>`_::
166
+
167
+ $ python -m pip install "pymongo[snappy]"
168
+
169
+ Wire protocol compression with zstandard requires `zstandard
170
+ <https://pypi.org/project/zstandard>`_::
171
+
172
+ $ python -m pip install "pymongo[zstd]"
173
+
174
+ Client-Side Field Level Encryption requires `pymongocrypt
175
+ <https://pypi.org/project/pymongocrypt/>`_::
176
+
177
+ $ python -m pip install "pymongo[encryption]"
178
+
179
+ You can install all dependencies automatically with the following
180
+ command::
181
+
182
+ $ python -m pip install "pymongo[gssapi,aws,ocsp,snappy,srv,tls,zstd,encryption]"
183
+
184
+ Additional dependencies are:
185
+
186
+ - (to generate documentation) sphinx_
187
+
188
+ Examples
189
+ ========
190
+ Here's a basic example (for more see the *examples* section of the docs):
191
+
192
+ .. code-block:: python
193
+
194
+ >>> import pymongo
195
+ >>> client = pymongo.MongoClient("localhost", 27017)
196
+ >>> db = client.test
197
+ >>> db.name
198
+ 'test'
199
+ >>> db.my_collection
200
+ Collection(Database(MongoClient('localhost', 27017), 'test'), 'my_collection')
201
+ >>> db.my_collection.insert_one({"x": 10}).inserted_id
202
+ ObjectId('4aba15ebe23f6b53b0000000')
203
+ >>> db.my_collection.insert_one({"x": 8}).inserted_id
204
+ ObjectId('4aba160ee23f6b543e000000')
205
+ >>> db.my_collection.insert_one({"x": 11}).inserted_id
206
+ ObjectId('4aba160ee23f6b543e000002')
207
+ >>> db.my_collection.find_one()
208
+ {'x': 10, '_id': ObjectId('4aba15ebe23f6b53b0000000')}
209
+ >>> for item in db.my_collection.find():
210
+ ... print(item["x"])
211
+ ...
212
+ 10
213
+ 8
214
+ 11
215
+ >>> db.my_collection.create_index("x")
216
+ 'x_1'
217
+ >>> for item in db.my_collection.find().sort("x", pymongo.ASCENDING):
218
+ ... print(item["x"])
219
+ ...
220
+ 8
221
+ 10
222
+ 11
223
+ >>> [item["x"] for item in db.my_collection.find().limit(2).skip(1)]
224
+ [8, 11]
225
+
226
+ Documentation
227
+ =============
228
+
229
+ Documentation is available at `pymongo.readthedocs.io <https://pymongo.readthedocs.io/en/stable/>`_.
230
+
231
+ To build the documentation, you will need to install sphinx_.
232
+ Documentation can be generated by running **python
233
+ setup.py doc**. Generated documentation can be found in the
234
+ *doc/build/html/* directory.
235
+
236
+ Testing
237
+ =======
238
+
239
+ The easiest way to run the tests is to run **python setup.py test** in
240
+ the root of the distribution.
241
+
242
+ To verify that PyMongo works with Gevent's monkey-patching::
243
+
244
+ $ python green_framework_test.py gevent
245
+
246
+ Or with Eventlet's::
247
+
248
+ $ python green_framework_test.py eventlet
249
+
250
+ .. _sphinx: https://www.sphinx-doc.org/en/master/