module DynFork::QCommons::Many

Overview

Queries like find many.

Extended Modules

Direct including types

Defined in:

dynfork/commons/many.cr

Instance Method Summary

Instance Method Detail

def delete_many(filter, *, collation : Mongo::Collation | Nil = nil, hint : String | Hash | NamedTuple | Nil = nil, ordered : Bool | Nil = nil, write_concern : Mongo::WriteConcern | Nil = nil, session : Mongo::Session::ClientSession | Nil = nil) : Mongo::Commands::Common::DeleteResult | Nil #

Deletes multiple documents.

NOTE For more details, please check the official documentation.

NOTE For more details, please check the cryomongo documentation.


[View source]
def find_many_to_hash_list(filter = BSON.new, *, sort = nil, projection = nil, hint : String | Hash | NamedTuple | Nil = nil, skip : Int32 | Nil = nil, limit : Int32 | Nil = nil, batch_size : Int32 | Nil = nil, single_batch : Bool | Nil = nil, comment : String | Nil = nil, max_time_ms : Int64 | Nil = nil, read_concern : Mongo::ReadConcern | Nil = nil, max = nil, min = nil, return_key : Bool | Nil = nil, show_record_id : Bool | Nil = nil, tailable : Bool | Nil = nil, oplog_replay : Bool | Nil = nil, no_cursor_timeout : Bool | Nil = nil, await_data : Bool | Nil = nil, allow_partial_results : Bool | Nil = nil, allow_disk_use : Bool | Nil = nil, collation : Mongo::Collation | Nil = nil, read_preference : Mongo::ReadPreference | Nil = nil, session : Mongo::Session::ClientSession | Nil = nil) : Array(Hash(String, DynFork::Globals::FieldValueTypes)) | Nil #

Finds the documents matching the Model.
Converts documents into a array of Hash objects.

NOTE For more details, please check the official documentation.

NOTE For an overview of read operations, check the official manual.

NOTE For more details, please check the cryomongo documentation.

Example:

arr = ModelName.find_many_to_hash_list({qty: {"$gt": 4}})

[View source]
def find_many_to_json(filter = BSON.new, *, sort = nil, projection = nil, hint : String | Hash | NamedTuple | Nil = nil, skip : Int32 | Nil = nil, limit : Int32 | Nil = nil, batch_size : Int32 | Nil = nil, single_batch : Bool | Nil = nil, comment : String | Nil = nil, max_time_ms : Int64 | Nil = nil, read_concern : Mongo::ReadConcern | Nil = nil, max = nil, min = nil, return_key : Bool | Nil = nil, show_record_id : Bool | Nil = nil, tailable : Bool | Nil = nil, oplog_replay : Bool | Nil = nil, no_cursor_timeout : Bool | Nil = nil, await_data : Bool | Nil = nil, allow_partial_results : Bool | Nil = nil, allow_disk_use : Bool | Nil = nil, collation : Mongo::Collation | Nil = nil, read_preference : Mongo::ReadPreference | Nil = nil, session : Mongo::Session::ClientSession | Nil = nil) : String | Nil #

Finds the documents matching the Model.
Converts documents to a json string.

NOTE For more details, please check the official documentation.

NOTE For an overview of read operations, check the official manual.

NOTE For more details, please check the cryomongo documentation.

Example:

json_str = ModelName.find_many_to_json({qty: {"$gt": 4}})

[View source]