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. |
Counts the number of documents in the collection according to the given options. | |
Counts the number of documents in the collection according to the given options. | |
count () Cuenta el número de documentos en la colección. | |
Removes all documents from the collection that match the given query filter. | |
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. |
Finds a document in the collection. | |
Finds a document in the collection. | |
Finds a document in the collection. | |
Finds a document in the collection. | |
Finds a document in the collection. | |
findOne () Finds a document in the collection. | |
findOneAndDelete <ResultT >( ) Finds a document in the collection and delete it. | |
Finds a document in the collection and delete it. | |
Finds a document in the collection and delete it. | |
Finds a document in the collection and delete it. | |
findOneAndReplace <ResultT >( ) Finds a document in the collection and replaces it with the given document. | |
Finds a document in the collection and replaces it with the given document. | |
Finds a document in the collection and replaces it with the given document. | |
Finds a document in the collection and replaces it with the given document. | |
findOneAndUpdate <ResultT >( ) Finds a document in the collection and performs the given update. | |
Finds a document in the collection and performs the given update. | |
Finds a document in the collection and performs the given update. | |
Finds a document in the collection and performs the given update. | |
Registro de códecspúblico | 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 () Obtiene el espacio de nombres de esta colección, es decir |
Inserta uno o más documentos. | |
Inserts the provided document. | |
Update all documents in the collection according to the specified arguments. | |
Update all documents in the collection according to the specified arguments. | |
Update a single document in the collection according to the specified arguments. | |
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 | Observa identificaciones específicas en una colección de forma asincrónica. |
public RealmEventStreamAsyncTask | Observa identificaciones específicas en una colección de forma asincrónica. |
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 una tarea que contiene el resultado de la operación de eliminar uno |
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. Todos los documentos se entregarán en forma de FindIterable del que se podrán extraer elementos individuales. 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. Todos los documentos se entregarán en forma de FindIterable del que se podrán extraer elementos individuales. 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. Todos los documentos se entregarán en forma de FindIterable del que se podrán extraer elementos individuales. Type Parameters
Parámetros
Devuelve an iterable containing the result of the find operation |
Encuentra todos los documentos en la colección especificando una clase de salida. Todos los documentos se entregarán en forma de FindIterable del cual se pueden extraer elementos individuales. 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. Todos los documentos se entregarán en forma de FindIterable del que se podrán extraer elementos individuales. 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 El registro de códecs para esta colección |
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 una tarea que contiene el resultado de la operación de inserción múltiple |
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. |
Observa identificaciones específicas en una colección de forma asincrónica. Parámetros
Devuelve a task that provides access to the stream of change events. |
public RealmEventStreamAsyncTask watchAsync () |
|---|
Observa una colección de forma asíncrona. El flujo resultante recibirá notificaciones de todos los eventos de esta colección que el usuario activo esté autorizado a ver, según las reglas de MongoDB Realm configuradas. Devuelve a task that provides access to the stream of change events. |
verConFiltro
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 |