Commit Graph

169 Commits

Author SHA1 Message Date
Bernie Hackett
12bd4ac5ea PYTHON-1097 - Support GridFS custom file_id methods 2016-06-17 19:06:47 -07:00
aherlihy
a3cf3cf568 PYTHON-1031 - GridFsBucket.download_to_stream now uses GridOutIterator 2015-12-15 15:28:20 -05:00
Bernie Hackett
08a668f36d PYTHON-1019 - GridIn must use ReadPreference.PRIMARY 2015-12-07 11:23:06 -08:00
aherlihy
04b1b8ad34 open_upload_stream returns only GridIn 2015-08-11 12:14:06 -04:00
aherlihy
b9baa8ae8a PYTHON-960 - GridFS spec compliance 2015-08-06 12:41:40 -04:00
aherlihy
6b644054b7 PYTHON-860 - Ignore unauthorized errors for index creation in GridFs 2015-07-21 12:33:34 -04:00
Bernie Hackett
5fcc5c72ac PYTHON-951 - Raise CorruptGridFile for truncated chunks. 2015-06-16 16:43:15 -07:00
behackett
42fc925b11 PYTHON-900 - Fix GridFS.delete(). 2015-04-16 20:20:22 -07:00
Bernie Hackett
aec685b374 Fix up copyright dates. 2015-03-25 11:55:02 -07:00
Bernie Hackett
f93c73aa73 PYTHON-861 - create/ensure index changes
- Deprecate ensure_index
- Remove caching from create_index
- In create_index, remove support for the cache_for param, and the
  bucket_size and drop_dups aliases (they all remain in ensure_index)
- GridFS uses create_index
- Fix up tests.
2015-03-14 13:38:13 -07:00
Bernie Hackett
3f3b6bedfc PYTHON-846 - Database.connection -> Database.client 2015-02-25 11:57:39 -08:00
Bernie Hackett
7164ba2f41 PYTHON-839 - Better validation error messages. 2015-02-25 10:14:29 -08:00
Bernie Hackett
12d74ff56f PYTHON-821 - Use new CRUD API in GridFS. 2015-02-13 13:12:58 -08:00
behackett
c07e543e58 PYTHON-820 - API changes for find/find_one to comply with CRUD spec.
- Changed parameter names (default values and behaviors remain the same):
  - spec (spec_or_id in find_one) -> filter
  - fields -> projection
  - partial -> allow_partial_results

- The "timeout" option is renamed to "no_cursor_timeout" with its default
  changed to False.

- The tailable, await_data, and exhaust options will be replaced with a
  cursor_type option. Valid values:
  - cursor.NON_TAILABLE
  - cursor.TAILABLE
  - cursor.TAILABLE_AWAIT
  - cursor.EXHAUST

- The following options are added:
  - oplog_replay (bool - default False) - only valid with tailable cursors
    against the oplog.
  - modifiers (document - default None) - A dict of query modifiers. See
    http://docs.mongodb.org/manual/reference/operator/query-modifier/#modifiers for
    options.

- The following options are removed, replaced by the "modifiers" option:
  - max_scan
  - snapshot

- The as_class option is removed. Use Collection.with_options instead.
2015-01-19 22:10:56 -08:00
Bernie Hackett
73edd2c134 PYTHON-785 - Really check Collection's write_concern in GridFS. 2014-12-23 12:04:10 -08:00
Bernie Hackett
0c277f6fd2 PYTHON-785 - Check Collection's write_concern in GridFS 2014-12-20 22:34:47 -08:00
A. Jesse Jiryu Davis
b1183ada1f PYTHON-785 No need for getlasterror before filemd5.
Obsoleted by commit fab611f63.
2014-12-20 09:29:56 -05:00
Bernie Hackett
f6a260c683 PYTHON-805 - Add with_options and remove per helper read_preference
This change removes the read_preference parameter from various
command helpers on the Collection object. Those options were
never shipped in a PyMongo release. It also documents which
helpers obey Collection.read_preference.

The bigger change is the removal of the read_preference, tag_sets,
and secondary_acceptable_latency_ms params from find() and find_one()
- a major backward breaking change. Collection.with_options
is intended to replace their use.

coll.find(read_preference=ReadPreference.SECONDARY)

changes to

coll.with_options(read_preference=ReadPreference.SECONDARY).find()
2014-12-17 15:06:03 -08:00
A. Jesse Jiryu Davis
2ba730722b PYTHON-526 Remove 'compile_re' option.
PyMongo now never attempts to compile BSON regular expressions as Python native
regular expressions.
2014-12-05 14:06:38 -05:00
A. Jesse Jiryu Davis
fab611f63c PYTHON-785 Don't use requests in GridFS. 2014-11-21 20:19:40 -05:00
A. Jesse Jiryu Davis
9143e187d3 Remove GridFS.open and close, and GridFile. 2014-10-31 14:15:25 -04:00
A. Jesse Jiryu Davis
08dccbba46 Remove ancient version annotations.
Delete "versionchanged" and "versionadded" directives that predate 2.0.
2014-10-31 14:15:24 -04:00
A. Jesse Jiryu Davis
7bda4586d6 Style. 2014-10-28 16:20:53 -04:00
ximing
facd8945b9 Add find_one() method for gridfs. 2014-10-28 15:54:57 -04:00
Adam Comerford
4b70b2a6f7 Update grid_file.py
Comments need to reflect 256 to 255 kb default chunk size change to propagate to docs
2014-10-17 13:47:54 -04:00
A. Jesse Jiryu Davis
73c9c3b0da PYTHON-749 Handle floating-point chunkSize in GridOut.
(cherry picked from commit 41dc866)
2014-10-08 13:00:12 -04:00
A. Jesse Jiryu Davis
2f9d24ade6 PYTHON-525 Reimplement MongoClient to use Cluster.
Replace MongoClient with an implementation that relies on Cluster and Server. The new MongoClient takes over MongoReplicaSetClient's responsibilities.

Authentication, secondary-pinning, and Mongos high-availability are broken and will be reimplemented in a future commit. RS tests are temporarily disabled.
2014-08-28 16:57:57 -04:00
Bernie Hackett
be35ff71a2 PYTHON-719 Read preference backward compatibility
This commit does a few things:

- Adds tag_sets back (deprecated)
- Adds secondary_acceptable_latency_ms back (deprecated)
- Makes acceptable latency a per read preference setting
- Cleans up read preference instance generation
- Adds latencyThresholdMS as an alias for secondaryAcceptableLatencyMS.
The name may change before 3.0 is released.
2014-06-27 15:05:20 -07:00
Bernie Hackett
fceb009955 PYTHON-691 - Fix UserWarning command issues.
Don't raise UserWarning for helpers and internal calls to
commands that do not obey read preference.
2014-04-29 13:38:21 -07:00
Bernie Hackett
35410a22e3 PYTHON-675 - Use bytes instead of binary_type 2014-04-23 13:22:57 -07:00
Luke Lovett
69ce42c5a0 PYTHON-675 python 2/3 single-source for the gridfs module 2014-04-23 18:37:02 +00:00
behackett
e0b52baf8e PYTHON-672 - Make read preference a class
This commit introduces the following changes:

- Each read preference is now a class.
- Read preferences other than Primary accept a tag_sets parameter.
- The tag_sets attribute of MongoClient, Database, and Collection has
  been removed. Use the tag_sets parameter of the new classes instead.
- The read_preferences.ReadPreference constant still exists and should
continue to work as expected for most users.
2014-04-14 16:28:07 -07:00
Bernie Hackett
2f86207246 PYTHON-526 secondaryAcceptableLatencyMS changes.
- Renamed to acceptableLatencyMS since it is also used
in choosing a new mongos during mongos HA failover.
- Moved to a global immutable setting. The expectation is
that the value would be determined by a network/system
admin. Changing it per operation doesn't make a lot of
sense.

Note - it's possible the name of this option may change again
before 3.0 is released.
2014-04-08 15:27:18 -07:00
A. Jesse Jiryu Davis
3a4d894afa Lower default GridFS chunk size to 255k, PYTHON-661. 2014-03-24 16:37:10 -04:00
A. Jesse Jiryu Davis
ea38602bef Fix GridFS example code. 2014-02-25 14:50:01 -05:00
A. Jesse Jiryu Davis
2fa1750b07 Update copyright notices and company name. 2014-01-31 09:36:46 -05:00
Bernie Hackett
f423c079d9 Fix a few documentation issues. 2014-01-14 10:06:16 -08:00
Bernie Hackett
3a197c8467 Fix GridOutCursor iteration in py3 PYTHON-310 2014-01-13 18:14:13 -08:00
A. Jesse Jiryu Davis
a80b517849 Merge pull request #222 from 3rf/PYTHON-621
PYTHON-621: Fixed GridOut.read(0) returning string in Python 3
2014-01-09 13:04:30 -08:00
Kyle Erf
464941e5ad PYTHON-621: Fixed GridOut.read(0) returning string in Python 3 2014-01-07 09:51:56 -08:00
Kyle Erf
237754dbef PYTHON-310: Added find() method to gridfs
Allows iteration through arbitrary queries against the files collection using
a new GridOutCursor class.
2014-01-06 14:57:00 -08:00
A. Jesse Jiryu Davis
066dd33935 Further GridOut.readline optimization. 2013-12-20 10:39:24 -05:00
A. Jesse Jiryu Davis
df60a5fa97 Off-by-one in GridOut.readline(). 2013-12-20 10:39:06 -05:00
Curtis Vogt
3649a3a0d7 Improved performance of GridOut readline by creating readchunk method.
Previously readline would read one byte at a time using the read
method. By reading one byte at a time we would be slicing the buffer
over and over again causing readline to use more CPU than necessary.
2013-12-20 10:39:06 -05:00
A. Jesse Jiryu Davis
2a1724c633 Option to lazily connect GridFS and GridOut, always lazily connect GridIn. 2013-12-05 15:16:18 -05:00
A. Jesse Jiryu Davis
394711330d Ensure GridFS.list() never includes None, PYTHON-598. 2013-12-05 10:04:47 -05:00
A. Jesse Jiryu Davis
fd9abff394 Docstring grammar 2013-01-31 11:33:25 -05:00
Ross Lawley
2435f8609d GridFS.new_file fails to raise FileExists
When using a manual _id - PYTHON-453
2013-01-07 14:30:04 +00:00
behackett
139459beb9 Replace safe with w in internal methods PYTHON-437 2012-11-19 16:29:15 -08:00
A. Jesse Jiryu Davis
b47f679a17 GridFS writes must be in request PYTHON-423 2012-11-19 16:25:09 -05:00