io.realm.mongodb.mongo
La interfaz MongoCollection proporciona acceso de lectura y escritura a documentos. Utiliza MongoDatabase.getCollection para obtener una instancia de colección.
Antes de permitir cualquier acceso, debe haber un usuario activo con la sesión iniciada.
Resumen del método
Modificador y Tipo | Método y descripción |
|---|---|
public AggregateIterable | Agrega documentos según el pipeline de agregación especificado, definiendo una clase de salida. |
public AggregateIterable | Agrega documentos según el proceso de agregación especificado. |
public RealmResultTask | Counts the number of documents in the collection according to the given options. |
public RealmResultTask | Counts the number of documents in the collection according to the given options. |
public RealmResultTask | count () Cuenta el número de documentos en la colección. |
public RealmResultTask | Removes all documents from the collection that match the given query filter. |
public RealmResultTask | Remueve como máximo un documento de la colección que coincide con el filtro dado. |
public FindIterable | Busca todos los documentos en la colección que coinciden con el filtro dado, especificando una clase de salida y utilizando también FindOptions para construir la query. |
public FindIterable | Finds all documents in the collection that match the given filter specifying an output class. |
public FindIterable | Finds all documents in the collection that match the given filter using FindOptions to build the query. |
public FindIterable | Finds all documents in the collection that match the given filter. |
public FindIterable | Finds all documents in the collection specifying an output class and also using FindOptions to build the query. |
public FindIterable | Finds all documents in the collection specifying an output class. |
public FindIterable | Finds all documents in the collection using FindOptions to build the query. |
public FindIterable | find () Encuentra todos los documentos en la colección. |
public RealmResultTask | Finds a document in the collection. |
public RealmResultTask | Finds a document in the collection. |
public RealmResultTask | Finds a document in the collection. |
public RealmResultTask | Finds a document in the collection. |
public RealmResultTask | Finds a document in the collection. |
public RealmResultTask | findOne () Finds a document in the collection. |
public RealmResultTask | findOneAndDelete <ResultT >( ) Finds a document in the collection and delete it. |
public RealmResultTask | Finds a document in the collection and delete it. |
public RealmResultTask | Finds a document in the collection and delete it. |
public RealmResultTask | Finds a document in the collection and delete it. |
public RealmResultTask | findOneAndReplace <ResultT >( ) Finds a document in the collection and replaces it with the given document. |
public RealmResultTask | Finds a document in the collection and replaces it with the given document. |
public RealmResultTask | Finds a document in the collection and replaces it with the given document. |
public RealmResultTask | Finds a document in the collection and replaces it with the given document. |
public RealmResultTask | findOneAndUpdate <ResultT >( ) Finds a document in the collection and performs the given update. |
public RealmResultTask | Finds a document in the collection and performs the given update. |
public RealmResultTask | Finds a document in the collection and performs the given update. |
public RealmResultTask | Finds a document in the collection and performs the given update. |
public CodecRegistry | Obtiene el registro de códecs para MongoCollection. |
public Class | Gets the class of documents stored in this collection. |
public String | getName () Obtiene el nombre de esta colección |
public MongoNamespace | getNamespace () Gets the namespace of this collection, i.e. |
public RealmResultTask | Inserta uno o más documentos. |
public RealmResultTask | Inserts the provided document. |
public RealmResultTask | Update all documents in the collection according to the specified arguments. |
public RealmResultTask | Update all documents in the collection according to the specified arguments. |
public RealmResultTask | Update a single document in the collection according to the specified arguments. |
public RealmResultTask | Update a single document in the collection according to the specified arguments. |
public RealmEventStreamTask | Watches specified IDs in a collection. |
public RealmEventStreamTask | Watches specified IDs in a collection. |
public RealmEventStreamTask | watch () Observa una colección. |
public RealmEventStreamAsyncTask | Watches specified IDs in a collection asynchronously. |
public RealmEventStreamAsyncTask | Watches specified IDs in a collection asynchronously. |
public RealmEventStreamAsyncTask | watchAsync () Watches a collection asynchronously. |
public RealmEventStreamTask | Observa una colección. |
public RealmEventStreamTask | Observa una colección. |
public RealmEventStreamAsyncTask | Watches a collection asynchronously. |
public RealmEventStreamAsyncTask | Watches a collection asynchronously. |
public MongoCollection | Crea una nueva instancia de MongoCollection con un registro de códecs diferente. |
public MongoCollection | Creates a new MongoCollection instance with a different default class to cast any documents returned from the database into. |
Inherited Methods
Métodos heredados de la clase java.lang.Object:
getClass,hashCode,equals,clone,toString,notify,notifyAll,wait,wait,wait,finalize
Detalle del método
Agregar
public AggregateIterable aggregate <ResultT >( java.util.List<? extends Bson> pipeline, java.lang.Class<ResultT> resultClass ) |
|---|
Agrupa documentos según la pipeline de agregación especificada, especificando una clase de salida. Todos los documentos se entregarán en forma de un AggregateIterable del que se pueden extraer elementos individuales. Type Parameters
Parámetros
Devuelve an AggregateIterable from which the results can be extracted |
Aggregates documents according to the specified aggregation pipeline.All documents will be delivered in the form of an AggregateIterable from which individual elements can be extracted. Parámetros
Devuelve an AggregateIterable from which the results can be extracted |
count
Counts the number of documents in the collection according to the given options. Parámetros
Devuelve una tarea que contiene el número de documentos en la colección |
Counts the number of documents in the collection according to the given options. Parámetros
Devuelve una tarea que contiene el número de documentos en la colección |
public RealmResultTask count () |
|---|
Cuenta el número de documentos en la colección. Devuelve una tarea que contiene el número de documentos en la colección |
deleteMany
Elimina todos los documentos de la colección que coincidan con el filtro de query proporcionado. Si no hay documentos que coincidan, la colección no se modifica. Parámetros
Devuelve a task containing the result of the remove many operation |
deleteOne
Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified. Parámetros
Devuelve a task containing the result of the remove one operation |
buscar
public FindIterable find <ResultT >( ) |
|---|
Busca todos los documentos en la colección que coinciden con el filtro dado, especificando una clase de salida y utilizando también FindOptions para construir la query. All documents will be delivered in the form of a FindIterable from which individual elements can be extracted. Type Parameters
Parámetros
Devuelve an iterable containing the result of the find operation |
Finds all documents in the collection that match the given filter specifying an output class.All documents will be delivered in the form of a FindIterable from which individual elements can be extracted. Type Parameters
Parámetros
Devuelve an iterable containing the result of the find operation |
Finds all documents in the collection that match the given filter using FindOptions to build the query. All documents will be delivered in the form of a FindIterable from which individual elements can be extracted. Parámetros
Devuelve an iterable containing the result of the find operation |
Finds all documents in the collection that match the given filter.All documents will be delivered in the form of a FindIterable from which individual elements can be extracted. Parámetros
Devuelve an iterable containing the result of the find operation |
Finds all documents in the collection specifying an output class and also using FindOptions to build the query. All documents will be delivered in the form of a FindIterable from which individual elements can be extracted. Type Parameters
Parámetros
Devuelve an iterable containing the result of the find operation |
Finds all documents in the collection specifying an output class.All documents will be delivered in the form of a FindIterable from which individual elements can be extracted. Type Parameters
Parámetros
Devuelve an iterable containing the result of the find operation |
Finds all documents in the collection using FindOptions to build the query. All documents will be delivered in the form of a FindIterable from which individual elements can be extracted. Parámetros
Devuelve an iterable containing the result of the find operation |
public FindIterable find () |
|---|
Finds all documents in the collection.All documents will be delivered in the form of a FindIterable from which individual elements can be extracted. Devuelve an iterable containing the result of the find operation |
findOne
public RealmResultTask findOne <ResultT >( ) |
|---|
Finds a document in the collection. Type Parameters
Parámetros
Devuelve una tarea que contiene el resultado de la operación encontrar uno |
Finds a document in the collection. Parámetros
Devuelve una tarea que contiene el resultado de la operación encontrar uno |
Finds a document in the collection. Type Parameters
Parámetros
Devuelve una tarea que contiene el resultado de la operación encontrar uno |
Finds a document in the collection. Parámetros
Devuelve una tarea que contiene el resultado de la operación encontrar uno |
Finds a document in the collection. Type Parameters
Parámetros
Devuelve una tarea que contiene el resultado de la operación encontrar uno |
public RealmResultTask findOne () |
|---|
Finds a document in the collection. Devuelve una tarea que contiene el resultado de la operación encontrar uno |
findOneAndDelete
public RealmResultTask findOneAndDelete <ResultT >( ) |
|---|
Finds a document in the collection and delete it. Type Parameters
Parámetros
Devuelve a task containing the resulting document |
Finds a document in the collection and delete it. Parámetros
Devuelve a task containing the resulting document |
public RealmResultTask findOneAndDelete <ResultT >( Bson filter, java.lang.Class<ResultT> resultClass ) |
|---|
Finds a document in the collection and delete it. Type Parameters
Parámetros
Devuelve a task containing the resulting document |
Finds a document in the collection and delete it. Parámetros
Devuelve a task containing the resulting document |
findOneAndReplace
public RealmResultTask findOneAndReplace <ResultT >( ) |
|---|
Finds a document in the collection and replaces it with the given document. Type Parameters
Parámetros
Devuelve a task containing the resulting document |
public RealmResultTask findOneAndReplace ( ) |
|---|
Finds a document in the collection and replaces it with the given document. Parámetros
Devuelve a task containing the resulting document |
public RealmResultTask findOneAndReplace <ResultT >( ) |
|---|
Finds a document in the collection and replaces it with the given document. Type Parameters
Parámetros
Devuelve a task containing the resulting document |
Finds a document in the collection and replaces it with the given document. Parámetros
Devuelve a task containing the resulting document |
findOneAndUpdate
public RealmResultTask findOneAndUpdate <ResultT >( ) |
|---|
Finds a document in the collection and performs the given update. Type Parameters
Parámetros
Devuelve a task containing the resulting document |
Finds a document in the collection and performs the given update. Parámetros
Devuelve a task containing the resulting document |
public RealmResultTask findOneAndUpdate <ResultT >( ) |
|---|
Finds a document in the collection and performs the given update. Type Parameters
Parámetros
Devuelve a task containing the resulting document |
Finds a document in the collection and performs the given update. Parámetros
Devuelve a task containing the resulting document |
getCodecRegistry
public CodecRegistry getCodecRegistry () |
|---|
Obtiene el registro de códecs para MongoCollection. Devuelve the CodecRegistry for this collection |
getDocumentClass
public Class getDocumentClass () |
|---|
Obtiene la clase de documentos almacenados en esta colección. Si usaste el método simple MongoDatabase.getCollection(String) para obtener esta colección, esto es org.bson.documento . Devuelve the class of documents in this collection |
getName
getNamespace
public MongoNamespace getNamespace () |
|---|
Gets the namespace of this collection, i.e. the database and collection names together. Devuelve the namespace |
insertMany
Inserta uno o más documentos. Parámetros
Devuelve a task containing the result of the insert many operation |
insertOne
Inserta el documento proporcionado. Si al documento le falta un identificador, el cliente debe generar uno. Parámetros
Devuelve a task containing the result of the insert one operation |
updateMany
Update all documents in the collection according to the specified arguments. Parámetros
Devuelve a task containing the result of the update many operation |
Update all documents in the collection according to the specified arguments. Parámetros
Devuelve a task containing the result of the update many operation |
updateOne
Update a single document in the collection according to the specified arguments. Parámetros
Devuelve a task containing the result of the update one operation |
Update a single document in the collection according to the specified arguments. Parámetros
Devuelve a task containing the result of the update one operation |
reloj
Observa los IDs especificados en una colección. Esta sobrecarga práctica admite el caso de uso deObjectId que no sea BsonValue al envolverlo para el usuario en instancias de BsonObjectId. Parámetros
Devuelve a task that provides access to the stream of change events. |
Watches specified IDs in a collection. Parámetros
Devuelve a task that provides access to the stream of change events. |
public RealmEventStreamTask watch () |
|---|
Watches a collection. The resulting stream will be notified of all events on this collection that the active user is authorized to see based on the configured MongoDB Realm rules. Devuelve a task that provides access to the stream of change events. |
watchAsync
Watches specified IDs in a collection asynchronously. This convenience overload supports the use case of non-BsonValue instances of ObjectId by wrapping them in BsonObjectId instances for the user. Parámetros
Devuelve a task that provides access to the stream of change events. |
Watches specified IDs in a collection asynchronously. Parámetros
Devuelve a task that provides access to the stream of change events. |
public RealmEventStreamAsyncTask watchAsync () |
|---|
Watches a collection asynchronously. The resulting stream will be notified of all events on this collection that the active user is authorized to see based on the configured MongoDB Realm rules. Devuelve a task that provides access to the stream of change events. |
watchWithFilter
Watches a collection. The provided BSON document will be used as a match expression filter on the change events coming from the stream.See how to define a match filter . Definir la expresión de coincidencia para filtrar ChangeEvents es similar a cómo definir la expresión de coincidencia para activadores Parámetros
Devuelve a task that provides access to the stream of change events. |
Watches a collection. The provided document will be used as a match expression filter on the change events coming from the stream. This convenience overload supports the use of non-BsonDocument instances for the user. Vea cómo definir un filtro de coincidencia. Definir la expresión de coincidencia para filtrar ChangeEvents es similar a cómo definir la expresión de coincidencia para activadores Parámetros
Devuelve a task that provides access to the stream of change events. |
ObservaConFiltroAsync
Supervisa una colección de forma asincrónica. El documento BSON proporcionado se utilizará como un filtro de expresión de coincidencia en los eventos de cambio provenientes del flujo. Consulta cómo definir un filtro de coincidencia . Definir la expresión de coincidencia para filtrar ChangeEvents es similar a cómo definir la expresión de coincidencia para activadores Parámetros
Devuelve a task that provides access to the stream of change events. |
Watches a collection asynchronously. The provided document will be used as a match expression filter on the change events coming from the stream. This convenience overload supports the use of non-BsonDocument instances for the user. Vea cómo definir un filtro de coincidencia. Definir la expresión de coincidencia para filtrar ChangeEvents es similar a cómo definir la expresión de coincidencia para activadores Parámetros
Devuelve a task that provides access to the stream of change events. |
conCodecRegistry
Crea una nueva instancia de MongoCollection con un registro de códecs diferente. Parámetros
Devuelve a new MongoCollection instance with the different codec registry |
withDocumentClass
Creates a new MongoCollection instance with a different default class to cast any documents returned from the database into. Type Parameters
Parámetros
Devuelve a new MongoCollection instance with the different default class |