.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "MongoDB 3pm" .TH MongoDB 3pm "2022-06-30" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" MongoDB \- Official MongoDB Driver for Perl (EOL) .SH "VERSION" .IX Header "VERSION" version v2.2.2 .SH "END OF LIFE NOTICE" .IX Header "END OF LIFE NOTICE" Version v2.2.0 was the final feature release of the MongoDB Perl driver and version v2.2.2 is the final patch release. .PP \&\fBAs of August 13, 2020, the MongoDB Perl driver and related libraries have reached end of life and are no longer supported by MongoDB.\fR See the August 2019 deprecation notice for rationale. .PP If members of the community wish to continue development, they are welcome to fork the code under the terms of the Apache 2 license and release it under a new namespace. Specifications and test files for MongoDB drivers and libraries are published in an open repository: mongodb/specifications . .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use MongoDB; \& \& my $client = MongoDB\->connect(\*(Aqmongodb://localhost\*(Aq); \& my $collection = $client\->ns(\*(Aqfoo.bar\*(Aq); # database foo, collection bar \& my $result = $collection\->insert_one({ some => \*(Aqdata\*(Aq }); \& my $data = $collection\->find_one({ _id => $result\->inserted_id }); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is the official Perl driver for MongoDB . MongoDB is an open-source document database that provides high performance, high availability, and easy scalability. .PP A MongoDB server (or multi-server deployment) hosts a number of databases. A database holds a set of collections. A collection holds a set of documents. A document is a set of key-value pairs. Documents have dynamic schema. Using dynamic schema means that documents in the same collection do not need to have the same set of fields or structure, and common fields in a collection's documents may hold different types of data. .PP Here are some resources for learning more about MongoDB: .IP "\(bu" 4 MongoDB Manual .IP "\(bu" 4 MongoDB \s-1CRUD\s0 Introduction .IP "\(bu" 4 MongoDB Data Modeling Introductions .PP To get started with the Perl driver, see these pages: .IP "\(bu" 4 MongoDB Perl Driver Tutorial .IP "\(bu" 4 MongoDB Perl Driver Examples .PP Extensive documentation and support resources are available via the MongoDB community website . .SH "USAGE" .IX Header "USAGE" The MongoDB driver is organized into a set of classes representing different levels of abstraction and functionality. .PP As a user, you first create and configure a MongoDB::MongoClient object to connect to a MongoDB deployment. From that client object, you can get a MongoDB::Database object for interacting with a specific database. .PP From a database object, you can get a MongoDB::Collection object for \&\s-1CRUD\s0 operations on that specific collection, or a MongoDB::GridFSBucket object for working with an abstract file system hosted on the database. Each of those classes may return other objects for specific features or functions. .PP See the documentation of those classes for more details or the MongoDB Perl Driver Tutorial for an example. .PP MongoDB::ClientSession objects are generated from a MongoDB::MongoClient and allow for advanced consistency options, like causal-consistency and transactions. .SS "Error handling" .IX Subsection "Error handling" Unless otherwise documented, errors result in fatal exceptions. See MongoDB::Error for a list of exception classes and error code constants. .SH "METHODS" .IX Header "METHODS" .SS "connect" .IX Subsection "connect" .Vb 3 \& $client = MongoDB\->connect(); # localhost, port 27107 \& $client = MongoDB\->connect($host_uri); \& $client = MongoDB\->connect($host_uri, $options); .Ve .PP This function returns a MongoDB::MongoClient object. The first parameter is used as the \f(CW\*(C`host\*(C'\fR argument and must be a host name or connection string \&\s-1URI\s0. The second argument is optional. If provided, it must be a hash reference of constructor arguments for MongoDB::MongoClient::new. .PP If an error occurs, a MongoDB::Error object will be thrown. .PP \&\fB\s-1NOTE\s0\fR: To connect to a replica set, a replica set name must be provided. For example, if the set name is \f(CW"setA"\fR: .PP .Vb 1 \& $client = MongoDB\->connect("mongodb://example.com/?replicaSet=setA"); .Ve .SH "SUPPORTED MONGODB VERSIONS" .IX Header "SUPPORTED MONGODB VERSIONS" The driver has been tested against MongoDB versions 2.6 through 4.2. All features of these versions are supported, except for field-level encryption. The driver may work with future versions of MongoDB, but will not include support for new MongoDB features and should be \fBthoroughly tested\fR within applications before deployment. .SH "SEMANTIC VERSIONING SCHEME" .IX Header "SEMANTIC VERSIONING SCHEME" Starting with MongoDB \f(CW\*(C`v1.0.0\*(C'\fR, the driver reverts to the more familiar three-part version-tuple numbering scheme used by both Perl and MongoDB: \&\f(CW\*(C`vX.Y.Z\*(C'\fR .IP "\(bu" 4 \&\f(CW\*(C`X\*(C'\fR will be incremented for incompatible \s-1API\s0 changes. .IP "\(bu" 4 Even-value increments of \f(CW\*(C`Y\*(C'\fR indicate stable releases with new functionality. \f(CW\*(C`Z\*(C'\fR will be incremented for bug fixes. .IP "\(bu" 4 Odd-value increments of \f(CW\*(C`Y\*(C'\fR indicate unstable (\*(L"development\*(R") releases that should not be used in production. \f(CW\*(C`Z\*(C'\fR increments have no semantic meaning; they indicate only successive development releases. .PP See the Changes file included with releases for an indication of the nature of changes involved. .SH "ENVIRONMENT VARIABLES" .IX Header "ENVIRONMENT VARIABLES" If the \f(CW\*(C`PERL_MONGO_WITH_ASSERTS\*(C'\fR environment variable is true before the MongoDB module is loaded, then its various classes will be generated with internal type assertions enabled. This has a severe performance cost and is not recommended for production use. It may be useful in diagnosing bugs. .PP If the \f(CW\*(C`PERL_MONGO_NO_DEP_WARNINGS\*(C'\fR environment variable is true, then deprecated methods will not issue warnings when used. (Normally, a deprecation warning is issued once per call-site for deprecated methods.) .SH "THREADS" .IX Header "THREADS" Per threads documentation, use of Perl threads is discouraged by the maintainers of Perl and the MongoDB Perl driver does not test or provide support for use with threads. .SH "AUTHORS" .IX Header "AUTHORS" .IP "\(bu" 4 David Golden .IP "\(bu" 4 Rassi .IP "\(bu" 4 Mike Friedman .IP "\(bu" 4 Kristina Chodorow .IP "\(bu" 4 Florian Ragwitz .SH "CONTRIBUTORS" .IX Header "CONTRIBUTORS" .IP "\(bu" 4 Andrew Page .IP "\(bu" 4 Andrey Khozov .IP "\(bu" 4 Ashley Willis .IP "\(bu" 4 Ask Bjørn Hansen .IP "\(bu" 4 Bernard Gorman .IP "\(bu" 4 Brendan W. McAdams .IP "\(bu" 4 Brian Moss .IP "\(bu" 4 Casey Rojas .IP "\(bu" 4 Christian Hansen .IP "\(bu" 4 Christian Sturm .IP "\(bu" 4 Christian Walde .IP "\(bu" 4 Colin Cyr .IP "\(bu" 4 Danny Raetzsch .IP "\(bu" 4 David Morrison .IP "\(bu" 4 David Nadle .IP "\(bu" 4 David Steinbrunner .IP "\(bu" 4 David Storch .IP "\(bu" 4 diegok .IP "\(bu" 4 D. Ilmari Mannsåker .IP "\(bu" 4 Eric Daniels .IP "\(bu" 4 Finn Kempers (Shadowcat Systems Ltd) .IP "\(bu" 4 Gerard Goossen .IP "\(bu" 4 Glenn Fowler .IP "\(bu" 4 Graham Barr .IP "\(bu" 4 Hao Wu .IP "\(bu" 4 Harish Upadhyayula .IP "\(bu" 4 Jason Carey .IP "\(bu" 4 Jason Toffaletti .IP "\(bu" 4 Johann Rolschewski .IP "\(bu" 4 John A. Kunze .IP "\(bu" 4 Joseph Harnish .IP "\(bu" 4 Josh Matthews .IP "\(bu" 4 Joshua Juran .IP "\(bu" 4 J. Stewart .IP "\(bu" 4 Kamil Slowikowski .IP "\(bu" 4 Ken Williams .IP "\(bu" 4 Matthew Shopsin .IP "\(bu" 4 Matt S Trout .IP "\(bu" 4 Michael Langner .IP "\(bu" 4 Michael Rotmanov .IP "\(bu" 4 Mike Dirolf .IP "\(bu" 4 Mohammad S Anwar .IP "\(bu" 4 Nickola Trupcheff .IP "\(bu" 4 Nigel Gregoire .IP "\(bu" 4 Niko Tyni .IP "\(bu" 4 Nuno Carvalho .IP "\(bu" 4 Orlando Vazquez .IP "\(bu" 4 Othello Maurer .IP "\(bu" 4 Pan Fan .IP "\(bu" 4 Pavel Denisov .IP "\(bu" 4 Rahul Dhodapkar .IP "\(bu" 4 Robert Sedlacek (Shadowcat Systems Ltd) .IP "\(bu" 4 Robin Lee .IP "\(bu" 4 Roman Yerin .IP "\(bu" 4 Ronald J Kimball .IP "\(bu" 4 Ryan Chipman .IP "\(bu" 4 Slaven Rezic .IP "\(bu" 4 Slaven Rezic .IP "\(bu" 4 Stephen Oberholtzer .IP "\(bu" 4 Steve Sanbeg .IP "\(bu" 4 Stuart Watt .IP "\(bu" 4 Thomas Bloor (Shadowcat Systems Ltd) .IP "\(bu" 4 Tobias Leich .IP "\(bu" 4 Uwe Voelker .IP "\(bu" 4 Wallace Reis .IP "\(bu" 4 Wan Bachtiar .IP "\(bu" 4 Whitney Jackson .IP "\(bu" 4 Xavier Guimard .IP "\(bu" 4 Xtreak .IP "\(bu" 4 Zhihong Zhang .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is Copyright (c) 2020 by MongoDB, Inc. .PP This is free software, licensed under: .PP .Vb 1 \& The Apache License, Version 2.0, January 2004 .Ve