Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tGoMongoCollection.FindOne() has new overloads to find minimum or maximum value of a field. #20

Open
wants to merge 65 commits into
base: master
Choose a base branch
from

Conversation

tuurke63
Copy link

These overloads make it possible to find the maximum or minimum value of a field in a collection, similar to the SQL statement
SELECT MAX(Fieldname) from...

They simply return ONE document.

Arthur Hoornweg and others added 30 commits June 24, 2022 11:29
These overloads are necessary to quickly find the largest or smallest value of a field in a collection, like the SQL commands SELECT MAX() and SELECT MIN().
Added new overloads to TgoMongoCollection.FindOne;
Merging grijji master into fork's development branch
….Stats)

Added method IgoMongoCursor.Stats to retrieve statistics of a collection, see https://www.mongodb.com/docs/manual/reference/command/collStats/
Added method IgoMongoDatabase.DBCommandDoc (needed for IgoMongoCursor…
…meters. Conversion of native Delphi strings to/from the UTF8 codepage takes place there where it is needed.
…goDB Wire Protocols in the constructor.

This is a necessary first step to support the new wire protocol.
…ction name and database name as two separate parameters.

Grijjy.MongoDB.pas

- tGoMongoDatabase: Removed property "FullCommandCollectionName"
- tgoMongoCursor: Removed property "FullCollectionName"
- tGoMongoCollection: Removed property "FullName" and "FullCommandCollectionName"

- Moved COLLECTION_COMMAND from Grijjy.Mongodb.pas to Grijjy.MongoDB.Protocol.pas
- Renamed COLLECTION_ADMIN into DB_ADMIN and moved it from Grijjy.Mongodb.pas to Grijjy.MongoDB.Protocol.pas

Grijjy.MongoDB.Protocol.pas

- TMsgHeader now has basic format detection and validation

tgoMongoProtocol:
- all comms methods expect database name and collection name separately now.
- Receive logic is now a bit more resilient against data corruption
- New method RemoveReply
- New Method Recover
But there's a lot of obsolete tuff that can be removed if the deprecated/unsupported "old" protocol can be removed!
Bugfix: Unit test didn't pass
Renamed tgoMongoprotocol.opReplyMsgHeader into HaveReplyMsgHeader (Opcode op_reply is obsolete and will be removed.)
Better validation of msg format in comms buffer (TgoMongoMsgReply.Val…
"command" and "admincommand" now return a cursor instead of a single …
…MongoFindOptions) for flexible specification of the query.

This is much nicer that having tons of overloaded methods.

function firstBatchToCursor() re-named to CreateCursor().
igoMongoCollection.Find() now supports uses a fluent query interface
Arthur Hoornweg and others added 30 commits January 5, 2023 13:44
These DLL's were created by MongoDB Inc.
- New object tgoConnectionPool
- tgoMongoClient now has properties "Pooled" and "Available"

- "fProtocol" member removed from tgoMongoDatabase and tgoMongoProtocol and replaced by property "Protocol" which has a getter. The shared tgoMongoProtocol is owned by tgoMongoClient. tgoMongoDatabase and tgoMongoCollection can access it by reference and don't need a copy.

- Added some new methods to tgoCursorhelper
----------------
- Constructor Create() does not initiate the connection anymore, like Grijjy's original implementation.
This is to prevent a blocked/hanging constructor and unwanted exceptions.

- SEND() no longer does auto-connect. Instead, it is perfomed in OPMSG().
The reason: we need to know what compression methods the server supports before actually sending a message.

- Broken/Disconnected connections are no longer returned to the ClientSocketManager but destroyed instead.

- New property "Connected" with methods GetConnected and SetConnected, in case you want to do this manually.

- New method "Disconnect".
- Function "IsConnected" has been re-named to "EnsureConnected".
- ConnectionState() is no longer inlined.
- Function SupportsOPMSg() has been removed. OP_msg is the de-facto protocol in MongoDB now.
Compression is now always true except during authentication/hello.
Replytimeout is now a mandatory parameter for OPMSG.
Increased default Replytimeout from 5 to 30 seconds.
Increased initial receive buffer size from 32 to 128 KB.
Modified receive buffer growth strategy. It is no longer exponential and failures are recognized and caught.
SocketRecv() no longer allows exceptions to escape.
When SocketRecv () detects errors, it attempts to store an error notification packet in the replies buffer; this way the main thread can respond to it immediately instead of just being hit by a timeout.
Grijjy.MongoDB.pas:

Updated the list of known MongoDB errors. The list now corresponds to MongoDB version 8.0
Implemented several new exceptions
HandleCommandReply() will throw more concise exceptions if necessary.
Added overloads for igoMongoCollection.Update and igoMongoCollection.UpdateMany that return an additional flag telling you if a new record was inserted.
New class tgoMongoExpression for aggregates.
New class factory "Aggregate".
TgoDocCallback renamed into tgoDocEditor.

More unit tests and docs will follow soon.
More overloads in igoAggregationPipeline.
igoAggregationPipeline:re-named "pipeline" into "stages".
tgoMongoExpression: Many new functions.
Added new aggregation operator "count"
Added several new tgoMongoExpression methods.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant