Querying in client side minmongo on BSON NumberLong field - meteor

I have a field named 'time' that holds nanoseconds timestamps as NumberLong in MongoDB. NumberLong(212431234...)
Trying to query it in the browser via
time: {
$gte: 2134234234...
}
does not yield the expected results.
Is there a limitation on querying BSON fields on the browser minimongo?
I have tried converting the number in JavaScript to a BSON object via the BSON JavaScript library, but it does not seem the gte is working properly on that either.
How do I do a gte query on Numberlong on Meteor in the browser on a collection?

Related

DateTime filtering on microsoft.graph.chatMessage

I'm trying to pull recent messages in a chat. My Graph query is as follows
https://graph.microsoft.com/v1.0/me/chats/{chatId}/messages?$filter=lastModifiedDateTime gt 2022-07-27T07:13:28.000z
The query is valid but I get the following response
The query specified in the URI is not valid. Query option 'Filter' is not allowed.
To allow it, set the 'AllowedQueryOptions' property on EnableQueryAttribute or QueryValidationSettings.
This message seems like a server side error/message. Is it possible to perform DateTime filtering on MSGraph Endpoints?
According this, the endpoint
GET /me/chats/{chatId}/messages
does not support filtering.
Only the endpoint
GET /teams/{team-id}/channels/{channel-id}/messages/delta
supports filtering by lastModifiedDateTime and operator gt but it only goes back max 8 months.

How to obtain _ts in CosmosDB?

I have a Posts collection on CosmosDB and each post needs to have an insertion date. Since cosmosDB already inserts the _ts field on the documents, I thought that might use that value instead of inserting my own timestamp manually. However, when I try to put an object (in Java) into the collection I get the following error: 400 Unrecognized field "_ts" (class scc.models.User), not marked as ignorable.
Is there a way to obtain _ts in the objects (I'm not talking about a query to obtain _ts of a specific object but instead for _ts be one of the variables of the object when I retrieve it from CosmosDB).
You could just add a property
#JsonProperty("_ts") private String timeStamp; on your User model. If you give it a value when updating (marshalling) it seems to be ignored, but for transparency you could add #JsonIgnore on the timeStamp field as well. If you want to do more low level adjustments you could also provide your own version of the cosmosdbObjectMapper bean (see AbstractCosmosConfiguration).
I am using the C# SDK (I know you are Java - but maybe it's analogous.)
After retrieving a document, I can access the system property _ts as a DateTime via the property Resource.TimeStamp (within namespace Microsoft.Azure.Documents.)

Meteor won't publish collection with id's of type ObjectID

One of my collections contains documents with ObjectID's instead of Meteor style _ids's that are generated by Random.id().
I get error output in the server console saying 'Error: Meteor does not currently support objects other than ObjectID as ids' when I try to publish/subscribe to a subset of the collection.
This used to work fine, but appears to be problematic in Meteor 1.4.3.2. Does anyone have a pointer how to solve this issue?
The mongodb supports the _id field as a normal field, like this:
{
_id: "sa09d8asd98asd9sad8",
otherfield: "jdlskfjsdlk"
}
And supports the _id field as an ObjectID field, like this:
{
_id: ObjectID("sa09d8asd98asd9sad8"),
otherfield: "jdlskfjsdlk"
}
But in Meteor Apps, the _id field as an ObjectID is not supported and it will not work in publications and subscriptions functions. You will need to change your ObjectID's fields for normal _ids fields.

How to model Not In query in Couch DB [duplicate]

Folks, I was wondering what is the best way to model document and/or map functions that allows me "Not Equals" queries.
For example, my documents are:
1. { name : 'George' }
2. { name : 'Carlin' }
I want to trigger a query that returns every documents where name not equals 'John'.
Note: I don't have all possible names before hand. So the parameters in query can be any random text like 'John' in my example.
In short: there is no easy solution.
You have four options:
sending a multi range query
filter the view response with a server-side list function
using a CouchDB plugin
use the mango query language
sending a multi range query
You can request the view with two ranges defined by startkey and endkey. You have to choose the range so, that the key John is not requested.
Unfortunately you have to find the commit request that somewhere exists and compile your CouchDB with it. Its not included in the official source.
filter the view response with a server-side list function
Its not recommended but you can use a list function and ignore the row with the key John in your response. Its like you will do it with a JavaScript array.
using a CouchDB plugin
Create an additional index with e.g. couchdb-lucene. The lucene server has such query capabilities.
use the "mango" query language
Its included in the CouchDB 2.0 developer preview. Not ready for production but will be definitely included in the stable release.

How to get last modified date & author from search:search API?

I am uploading some documents in Marklogic Server (doc, docx, pdf, txt etc). Now I am building an interface in HTML & XQuery that allows a user to enter a search term and if that matches the contents of any documents, then that document name is displayed in the grid. I am using search:search API for searching. Now I also want to show last modified date and author of the document in the grid. Every windows document have last modified date and author property. But how can I get this information from search:search API so that I can show these information in the grid ?
If you have enabled the settings "maintain last modified," Marklogic keeps the last modified information in document property fragments. However, this is unrelated to the properties information kept in Windows, which are lost by default when you load them in Marklogic.
If you want to retain the Windows properties data, set up a filter in Information Studio to populate the Marklogic property fragments with the data. Alternately, you could write your own XSLT and use xdmp:document-filter() to store the data directly in the document.
Once you have loaded your documents and populated them with the properties you need, you can access the data directly if stored in the document, or using xdmp:document-properties() if stored in document properties.

Resources